‪TYPO3CMS  10.4
TYPO3\CMS\Backend\Routing\UriBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Routing\UriBuilder:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (Router $router=null)
 
Uri buildUriFromRoutePath ($pathInfo, $parameters=[], $referenceType=self::ABSOLUTE_PATH)
 
Uri buildUriFromRoute ($name, $parameters=[], $referenceType=self::ABSOLUTE_PATH)
 

Public Attributes

const ABSOLUTE_URL = 'url'
 
const ABSOLUTE_PATH = 'absolute'
 

Protected Member Functions

Uri buildUri ($parameters, $referenceType)
 

Protected Attributes

Router $router
 
array $generated = array( )
 

Detailed Description

Main UrlGenerator for creating URLs for the Backend. Generates a URL based on an identifier defined by Configuration/Backend/Routes.php of an extension, and adds some more parameters to the URL.

Currently only available and useful when called from Router->generate() as the information about possible routes needs to be handed over.

Definition at line 37 of file UriBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Routing\UriBuilder::__construct ( Router  $router = null)

Loads the router to fetch the available routes from the Router to be used for generating routes

Parameters
Router | null$router

Definition at line 61 of file UriBuilder.php.

References TYPO3\CMS\Backend\Routing\UriBuilder\$router.

Member Function Documentation

◆ buildUri()

Uri TYPO3\CMS\Backend\Routing\UriBuilder::buildUri (   $parameters,
  $referenceType 
)
protected

Internal method building a Uri object, merging the GET parameters array into a flat queryString

Parameters
array$parameters‪An array of GET parameters
string$referenceType‪The type of reference to be generated (one of the constants)
Returns
‪Uri

Definition at line 137 of file UriBuilder.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString(), TYPO3\CMS\Core\Utility\PathUtility\getAbsoluteWebPath(), and TYPO3\CMS\Core\Core\Environment\getBackendPath().

Referenced by TYPO3\CMS\Backend\Routing\UriBuilder\buildUriFromRoute().

◆ buildUriFromRoute()

Uri TYPO3\CMS\Backend\Routing\UriBuilder::buildUriFromRoute (   $name,
  $parameters = [],
  $referenceType = self::ABSOLUTE_PATH 
)

Generates a URL or path for a specific route based on the given parameters. When the route is configured with "access=public" then the token generation is left out.

If there is no route with the given name, the generator throws the RouteNotFoundException.

Parameters
string$name‪The name of the route
array$parameters‪An array of parameters
string$referenceType‪The type of reference to be generated (one of the constants)
Returns
‪Uri The generated Uri
Exceptions
RouteNotFoundException‪If the named route doesn't exist

Definition at line 97 of file UriBuilder.php.

References TYPO3\CMS\Backend\Routing\UriBuilder\buildUri(), TYPO3\CMS\Core\FormProtection\AbstractFormProtection\generateToken(), and TYPO3\CMS\Core\FormProtection\FormProtectionFactory\get().

Referenced by TYPO3\CMS\Backend\Routing\UriBuilder\buildUriFromRoutePath().

◆ buildUriFromRoutePath()

Uri TYPO3\CMS\Backend\Routing\UriBuilder::buildUriFromRoutePath (   $pathInfo,
  $parameters = [],
  $referenceType = self::ABSOLUTE_PATH 
)

Generates a URL or path for a specific route based on the given route. Currently used to link to the current script, it is encouraged to use "buildUriFromRoute" if possible.

If there is no route with the given name, the generator throws the RouteNotFoundException.

Parameters
string$pathInfo‪The path to the route
array$parameters‪An array of parameters
string$referenceType‪The type of reference to be generated (one of the constants)
Returns
‪Uri The generated Uri
Exceptions
RouteNotFoundException‪If the named route doesn't exist

Definition at line 78 of file UriBuilder.php.

References TYPO3\CMS\Backend\Routing\UriBuilder\$router, TYPO3\CMS\Backend\Routing\UriBuilder\buildUriFromRoute(), and TYPO3\CMS\Backend\Routing\Router\match().

Member Data Documentation

◆ $generated

array TYPO3\CMS\Backend\Routing\UriBuilder::$generated = array( )
protected

Definition at line 55 of file UriBuilder.php.

◆ $router

Router TYPO3\CMS\Backend\Routing\UriBuilder::$router
protected

◆ ABSOLUTE_PATH

◆ ABSOLUTE_URL