src/Routing/RoutingUtil.php
public function generateBackendRoute(array $params = [], $addToken = true, $addReferer = true)
    {
        if ($addToken) {
            // >= contao 4.6.8 uses contao.csrf.token_manager service to validate token
            if (System::getContainer()->has('contao.csrf.token_manager')) {
                $params['rt'] = System::getContainer()->get('contao.csrf.token_manager')->getToken($this->token)->getValue();
            } else {
                $params['rt'] = System::getContainer()->get('security.csrf.token_manager')->getToken($this->token)->getValue();
            }
        }

        if ($addReferer) {
            $params['ref'] = $this->request->getCurrentRequest()->get('_contao_referer_id');
        }

        return $this->router->generate('contao_backend', $params);
    }
public function generateBackendRoute(array $params = [], $addToken = true, $addReferer = true)
    {
        if ($addToken) {
            // >= contao 4.6.8 uses contao.csrf.token_manager service to validate token
            if (System::getContainer()->has('contao.csrf.token_manager')) {
                $params['rt'] = System::getContainer()->get('contao.csrf.token_manager')->getToken($this->token)->getValue();
            } else {
                $params['rt'] = System::getContainer()->get('security.csrf.token_manager')->getToken($this->token)->getValue();
            }
        }

        if ($addReferer) {
            $params['ref'] = $this->request->getCurrentRequest()->get('_contao_referer_id');
        }

        return $this->router->generate('contao_backend', $params);
    }
public function generateBackendRoute ( array $ params = [ ] , $ addToken = true , $ addReferer = true ) { if ( $ addToken ) { // >= contao 4.6.8 uses contao.csrf.token_manager service to validate token if ( System :: getContainer ( ) -> has ( 'contao.csrf.token_manager' ) ) { $ params [ 'rt' ] = System :: getContainer ( ) -> get ( 'contao.csrf.token_manager' ) -> getToken ( $ this -> token ) -> getValue ( ) ; } else { $ params [ 'rt' ] = System :: getContainer ( ) -> get ( 'security.csrf.token_manager' ) -> getToken ( $ this -> token ) -> getValue ( ) ; } } if ( $ addReferer ) { $ params [ 'ref' ] = $ this -> request -> getCurrentRequest ( ) -> get ( '_contao_referer_id' ) ; } return $ this -> router -> generate ( 'contao_backend' , $ params ) ; }
Generate a backend route with token and referer.

@param array $params     Url-Parameters
@param bool  $addToken
@param bool  $addReferer

@return string The backend route url
Generate a backend route with token and referer .