public create ( Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, string | null $locale = null ) : Aimeos\MW\View\Iface | ||
$context | Aimeos\MShop\Context\Item\Iface | Context object |
$templatePaths | array | List of base path names with relative template paths as key/value pairs |
$locale | string | null | Code of the current language or null for no translation |
return | Aimeos\MW\View\Iface | View object |
public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null)
{
$config = $context->getConfig();
$view = new \Aimeos\MW\View\Standard($templatePaths);
$this->addCsrf($view);
$this->addAccess($view, $context);
$this->addConfig($view, $config);
$this->addNumber($view, $config);
$this->addParam($view);
$this->addRequest($view);
$this->addResponse($view);
$this->addTranslate($view, $locale);
$this->addUrl($view);
return $view;
}
/** * Returns the output of the client and adds the header. * * @param string $clientName Html client name * @return string HTML code for inserting into the HTML body */ protected function getOutput($clientName) { $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates'); $context = $this->context->get($this->request); $langid = $context->getLocale()->getLanguageId(); $view = $this->viewContainer->create($context, $this->uriBuilder, $tmplPaths, $this->request, $langid); $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); $client->setView($view); $client->process(); $this->view->assign('aimeos_component_header', (string) $client->getHeader()); return $client->getBody(); }