setGlobalParams example

return $globalParams;
    }

    /** * @return void */
    public function updateFromEnlightRequest(EnlightRequest $request)
    {
        $this->setHost($request->getHttpHost());
        $this->setBaseUrl($request->getBaseUrl());
        $this->setSecure($request->isSecure());
        $this->setGlobalParams(self::getGlobalParamsFromRequest($request));
        $this->setParams($request->getQuery());
    }

    /** * @return Context */
    public static function createFromShop(ShopwareShop $shop, ShopwareConfig $config)
    {
        $self = new self(
            $shop->getHost() ?? 'localhost',
            $shop->getBaseUrl() ?? '',
            
$context = $router->getContext();
        $newContext = Context::createFromShop($shop$config);
        // Reuse the host         if ($newContext->getHost() === null) {
            $newContext->setHost($context->getHost());
            $newContext->setBaseUrl($context->getBaseUrl());
            $newContext->setSecure($context->isSecure());
        }
        // Reuse the global params like controller and action         $globalParams = $context->getGlobalParams();
        $newContext->setGlobalParams($globalParams);
        $router->setContext($newContext);
    }

    public function onPreDispatch(Enlight_Controller_EventArgs $args)
    {
        /** @var Enlight_Controller_Front $front */
        $front = $args->getSubject();
        $request = $front->Request();
        /** @var RouterInterface $router */
        $router = $front->ensureRouter();
        // Fix context on forward
Home | Imprint | This part of the site doesn't use cookies.