Aimeos\ShopBundle\Service\View::addUrl PHP Method

addUrl() protected method

Adds the "url" helper to the view object
protected addUrl ( Aimeos\MW\View\Iface $view ) : Aimeos\MW\View\Iface
$view Aimeos\MW\View\Iface View object
return Aimeos\MW\View\Iface Modified view object
    protected function addUrl(\Aimeos\MW\View\Iface $view)
    {
        $fixed = array();
        $request = $this->requestStack->getMasterRequest();
        if ($request !== null) {
            $attr = $request->attributes;
            if (($site = $attr->get('site')) !== null) {
                $fixed['site'] = $site;
            }
            if (($lang = $attr->get('locale')) !== null) {
                $fixed['locale'] = $lang;
            }
            if (($currency = $attr->get('currency')) !== null) {
                $fixed['currency'] = $currency;
            }
        }
        $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
        $view->addHelper('url', $helper);
        return $view;
    }