core-bundle/src/Routing/UrlGenerator.php
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH): ?string
    {
        $this->framework->initialize();

        if (!\is_array($parameters)) {
            $parameters = [];
        }

        $context = $this->getContext();

        // Store the original request context
        $host = $context->getHost();
        $scheme = $context->getScheme();
        $httpPort = $context->getHttpPort();
        $httpsPort = $context->getHttpsPort();

        $this->prepareLocale($parameters);
        $this->prepareAlias($name, $parameters);
        $this->prepareDomain($context, $parameters, $referenceType);

        unset($parameters['auto_item']);

        $url = $this->router->generate(
            'index' === $name ? 'contao_index' : 'contao_frontend',
            $parameters,
            $referenceType
        );

        // Reset the request context
        $context->setHost($host);
        $context->setScheme($scheme);
        $context->setHttpPort($httpPort);
        $context->setHttpsPort($httpsPort);

        return $url;
    }
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH): ?string
    {
        $this->framework->initialize();

        if (!\is_array($parameters)) {
            $parameters = [];
        }

        $context = $this->getContext();

        // Store the original request context
        $host = $context->getHost();
        $scheme = $context->getScheme();
        $httpPort = $context->getHttpPort();
        $httpsPort = $context->getHttpsPort();

        $this->prepareLocale($parameters);
        $this->prepareAlias($name, $parameters);
        $this->prepareDomain($context, $parameters, $referenceType);

        unset($parameters['auto_item']);

        $url = $this->router->generate(
            'index' === $name ? 'contao_index' : 'contao_frontend',
            $parameters,
            $referenceType
        );

        // Reset the request context
        $context->setHost($host);
        $context->setScheme($scheme);
        $context->setHttpPort($httpPort);
        $context->setHttpsPort($httpsPort);

        return $url;
    }
public function generate ( $ name , $ parameters = [ ] , $ referenceType = self :: ABSOLUTE_PATH ) : ? string { $ this -> framework -> initialize ( ) ; if ( ! \ is_array ( $ parameters ) ) { $ parameters = [ ] ; } $ context = $ this -> getContext ( ) ; // Store the original request context $ host = $ context -> getHost ( ) ; $ scheme = $ context -> getScheme ( ) ; $ httpPort = $ context -> getHttpPort ( ) ; $ httpsPort = $ context -> getHttpsPort ( ) ; $ this -> prepareLocale ( $ parameters ) ; $ this -> prepareAlias ( $ name , $ parameters ) ; $ this -> prepareDomain ( $ context , $ parameters , $ referenceType ) ; unset ( $ parameters [ 'auto_item' ] ) ; $ url = $ this -> router -> generate ( 'index' === $ name ? 'contao_index' : 'contao_frontend' , $ parameters , $ referenceType ) ; // Reset the request context $ context -> setHost ( $ host ) ; $ context -> setScheme ( $ scheme ) ; $ context -> setHttpPort ( $ httpPort ) ; $ context -> setHttpsPort ( $ httpsPort ) ; return $ url ; }
{@inheritdoc}
{