getGlobalParamsFromRequest example



    /** * @return Context */
    public static function createFromEnlightRequest(EnlightRequest $request)
    {
        return new self(
            $request->getHttpHost(),
            $request->getBaseUrl(),
            $request->isSecure(),
            self::getGlobalParamsFromRequest($request)
        );
    }

    /** * @see \Enlight_Controller_Router::setGlobalParam * * @return array{module?: string, controller?: string, action?: string} */
    public static function getGlobalParamsFromRequest(EnlightRequest $request)
    {
        $globalParams = [];
        


    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         $context = $router->getContext();
        $context->setGlobalParams($context::getGlobalParamsFromRequest($request));
    }

    private function convertIteratorToArray(iterable $iterator): array
    {
        if (\is_array($iterator)) {
            return $iterator;
        }

        return iterator_to_array($iterator, false);
    }
}
Home | Imprint | This part of the site doesn't use cookies.