‪TYPO3CMS  9.5
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)
 
Uri buildUriFromModule ($moduleName, $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 34 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 58 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 159 of file UriBuilder.php.

References 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\buildUriFromModule(), and TYPO3\CMS\Backend\Routing\UriBuilder\buildUriFromRoute().

◆ buildUriFromModule()

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

Generate a URI for a backend module, does not check if a module is available though

Parameters
string$moduleName‪The name of the module
array$parameters‪An array of parameters
string$referenceType‪The type of reference to be generated (one of the constants)
Returns
‪Uri The generated Uri
Deprecated:
‪since TYPO3 v9.3, will be removed in TYPO3 v10.0. Use buildUriFromRoute() instead.

Definition at line 136 of file UriBuilder.php.

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

◆ 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 94 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 75 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 52 of file UriBuilder.php.

◆ $router

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

◆ ABSOLUTE_PATH

◆ ABSOLUTE_URL

const TYPO3\CMS\Backend\Routing\UriBuilder::ABSOLUTE_URL = 'url'

Generates an absolute URL

Definition at line 39 of file UriBuilder.php.

Referenced by TYPO3\CMS\Workspaces\Controller\PreviewController\handleRequest().