本文整理匯總了PHP中Aimeos\MShop\Context\Item\Iface::setLocale方法的典型用法代碼示例。如果您正苦於以下問題:PHP Iface::setLocale方法的具體用法?PHP Iface::setLocale怎麽用?PHP Iface::setLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Aimeos\MShop\Context\Item\Iface
的用法示例。
在下文中一共展示了Iface::setLocale方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get
/**
* Returns the current context
*
* @param boolean $locale True to add locale object to context, false if not (deprecated, use \Aimeos\Shop\Base\Locale)
* @param string $type Configuration type, i.e. "frontend" or "backend" (deprecated, use \Aimeos\Shop\Base\Config)
* @return \Aimeos\MShop\Context\Item\Iface Context object
*/
public function get($locale = true, $type = 'frontend')
{
$config = $this->config->get($type);
if ($this->context === null) {
$context = new \Aimeos\MShop\Context\Item\Standard();
$context->setConfig($config);
$this->addDataBaseManager($context);
$this->addFilesystemManager($context);
$this->addMessageQueueManager($context);
$this->addLogger($context);
$this->addCache($context);
$this->addMailer($context);
$this->addSession($context);
$this->addUser($context);
$this->addGroups($context);
$this->context = $context;
}
$this->context->setConfig($config);
if ($locale === true) {
$localeItem = $this->locale->get($this->context);
$this->context->setLocale($localeItem);
$this->context->setI18n($this->i18n->get(array($localeItem->getLanguageId())));
}
return $this->context;
}