Aimeos\Shop\Base\Locale::getBackend PHP Method

getBackend() public method

Returns the locale item for the current request
public getBackend ( Aimeos\MShop\Context\Item\Iface $context, string $site ) : Aimeos\MShop\Locale\Item\Iface
$context Aimeos\MShop\Context\Item\Iface Context object
$site string Unique site code
return Aimeos\MShop\Locale\Item\Iface Locale item object
    public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site)
    {
        $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
        try {
            $localeItem = $localeManager->bootstrap($site, '', '', false);
            $localeItem->setLanguageId(null);
            $localeItem->setCurrencyId(null);
        } catch (\Aimeos\MShop\Locale\Exception $e) {
            $localeItem = $localeManager->createItem();
        }
        return $localeItem;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Single entry point for all JSON admin requests.
  */
 public function doAction()
 {
     $context = $this->context->get(null, 'backend');
     $context->setLocale($this->locale->getBackend($context, 'default'));
     $context->setView($this->viewcontainer->create($context, $this->uriBuilder, array(), $this->request));
     $cntlPaths = $this->aimeos->get()->getCustomPaths('controller/extjs');
     $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
     if (($content = file_get_contents('php://input')) === false) {
         throw new \Exception('Unable to get request content');
     }
     return $controller->process($this->request->getArguments(), $content);
 }
All Usage Examples Of Aimeos\Shop\Base\Locale::getBackend