public function generate(FilterUrl $filterUrl)
    {
        $jumpTo = $filterUrl->getPage();

        // If no alias given, stay on current page.
        if (empty($jumpTo['alias'])) {
            $this->addFromCurrentRequest($filterUrl = $filterUrl->clone(), []);

            $jumpTo = $filterUrl->getPage();
        }
        $alias = $jumpTo['alias'];

        $parameters = $filterUrl->getGetParameters();

        $url = $alias;
        if ($filterUrl->hasSlug('auto_item')) {
            $url .= '/' . $this->encodeForAllowEncodedSlashes($filterUrl->getSlug('auto_item'));
        }

        if (!empty($jumpTo['domain'])) {
            $parameters['_domain'] = $jumpTo['domain'];
        }
        if (!empty($jumpTo['rootUseSSL'])) {
            $parameters['_ssl'] = (bool) $jumpTo['rootUseSSL'];
        }

        if ($filterUrl->hasSlug('language')) {
            $parameters['_locale'] = $filterUrl->getSlug('language');
        }
        foreach ($filterUrl->getSlugParameters() as $name => $value) {
            if (in_array($name, ['language', 'auto_item'])) {
                continue;
            }

            // Encode slashes in slugs - otherwise Symfony won't handle them correctly.
            // This mitigates for http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes
            // If not given, apache would 404 otherwise.
            $url .= '/' . $this->encodeForAllowEncodedSlashes($name) .
                '/' . $this->encodeForAllowEncodedSlashes($value);
        }

        return $this->urlGenerator->generate($url, $parameters);
    }
public function generate(FilterUrl $filterUrl)
    {
        $jumpTo = $filterUrl->getPage();

        // If no alias given, stay on current page.
        if (empty($jumpTo['alias'])) {
            $this->addFromCurrentRequest($filterUrl = $filterUrl->clone(), []);

            $jumpTo = $filterUrl->getPage();
        }
        $alias = $jumpTo['alias'];

        $parameters = $filterUrl->getGetParameters();

        $url = $alias;
        if ($filterUrl->hasSlug('auto_item')) {
            $url .= '/' . $this->encodeForAllowEncodedSlashes($filterUrl->getSlug('auto_item'));
        }

        if (!empty($jumpTo['domain'])) {
            $parameters['_domain'] = $jumpTo['domain'];
        }
        if (!empty($jumpTo['rootUseSSL'])) {
            $parameters['_ssl'] = (bool) $jumpTo['rootUseSSL'];
        }

        if ($filterUrl->hasSlug('language')) {
            $parameters['_locale'] = $filterUrl->getSlug('language');
        }
        foreach ($filterUrl->getSlugParameters() as $name => $value) {
            if (in_array($name, ['language', 'auto_item'])) {
                continue;
            }

            // Encode slashes in slugs - otherwise Symfony won't handle them correctly.
            // This mitigates for http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes
            // If not given, apache would 404 otherwise.
            $url .= '/' . $this->encodeForAllowEncodedSlashes($name) .
                '/' . $this->encodeForAllowEncodedSlashes($value);
        }

        return $this->urlGenerator->generate($url, $parameters);
    }
public function generate ( FilterUrl $ filterUrl ) { $ jumpTo = $ filterUrl -> getPage ( ) ; // If no alias given, stay on current page. if ( empty ( $ jumpTo [ 'alias' ] ) ) { $ this -> addFromCurrentRequest ( $ filterUrl = $ filterUrl -> clone ( ) , [ ] ) ; $ jumpTo = $ filterUrl -> getPage ( ) ; } $ alias = $ jumpTo [ 'alias' ] ; $ parameters = $ filterUrl -> getGetParameters ( ) ; $ url = $ alias ; if ( $ filterUrl -> hasSlug ( 'auto_item' ) ) { $ url .= '/' . $ this -> encodeForAllowEncodedSlashes ( $ filterUrl -> getSlug ( 'auto_item' ) ) ; } if ( ! empty ( $ jumpTo [ 'domain' ] ) ) { $ parameters [ '_domain' ] = $ jumpTo [ 'domain' ] ; } if ( ! empty ( $ jumpTo [ 'rootUseSSL' ] ) ) { $ parameters [ '_ssl' ] = ( bool ) $ jumpTo [ 'rootUseSSL' ] ; } if ( $ filterUrl -> hasSlug ( 'language' ) ) { $ parameters [ '_locale' ] = $ filterUrl -> getSlug ( 'language' ) ; } foreach ( $ filterUrl -> getSlugParameters ( ) as $ name => $ value ) { if ( in_array ( $ name , [ 'language' , 'auto_item' ] ) ) { continue ; } // Encode slashes in slugs - otherwise Symfony won't handle them correctly. // This mitigates for http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes // If not given, apache would 404 otherwise. $ url .= '/' . $ this -> encodeForAllowEncodedSlashes ( $ name ) . '/' . $ this -> encodeForAllowEncodedSlashes ( $ value ) ; } return $ this -> urlGenerator -> generate ( $ url , $ parameters ) ; }
Generate a frontend url.

@param FilterUrl $filterUrl The filter URL.

@return string
Generate a frontend url .