TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
UriBuilder Class Reference

Public Member Functions

 buildUriFromRoute ($name, $parameters=array(), $referenceType=self::ABSOLUTE_PATH)
 
 buildUriFromModule ($moduleName, $parameters=array(), $referenceType=self::ABSOLUTE_PATH)
 
 buildUriFromAjaxId ($ajaxIdentifier, $parameters=array(), $referenceType=self::ABSOLUTE_PATH)
 

Public Attributes

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

Protected Member Functions

 loadBackendRoutes ()
 
 buildUri ($parameters, $referenceType)
 

Protected Attributes

 $routes
 

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 31 of file backend/Classes/Routing/UriBuilder.php.

Member Function Documentation

buildUri (   $parameters,
  $referenceType 
)
protected

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

Parameters
array$parametersAn array of GET parameters
string$referenceTypeThe type of reference to be generated (one of the constants)
Returns
Uri

Definition at line 160 of file backend/Classes/Routing/UriBuilder.php.

References PathUtility\getAbsoluteWebPath(), GeneralUtility\getIndpEnv(), GeneralUtility\implodeArrayForUrl(), and GeneralUtility\makeInstance().

Referenced by UriBuilder\buildUriFromAjaxId(), UriBuilder\buildUriFromModule(), and UriBuilder\buildUriFromRoute().

buildUriFromAjaxId (   $ajaxIdentifier,
  $parameters = array(),
  $referenceType = self::ABSOLUTE_PATH 
)

Returns the Ajax URL for a given AjaxID including a CSRF token.

This method is only called by the core and must not be used by extensions. Ajax URLs of all registered backend Ajax handlers are automatically published to JavaScript inline settings: TYPO3.settings.ajaxUrls['ajaxId']

Parameters
string$ajaxIdentifierthe ajaxID (used as GET parameter)
array$parametersAn array of parameters
string$referenceTypeThe type of reference to be generated (one of the constants)
Returns
Uri The generated Uri

Definition at line 141 of file backend/Classes/Routing/UriBuilder.php.

References $GLOBALS, UriBuilder\buildUri(), and FormProtectionFactory\get().

buildUriFromModule (   $moduleName,
  $parameters = array(),
  $referenceType = self::ABSOLUTE_PATH 
)

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

Parameters
string$moduleNameThe name of the module
array$parametersAn array of parameters
string$referenceTypeThe type of reference to be generated (one of the constants)
Returns
Uri The generated Uri

Definition at line 119 of file backend/Classes/Routing/UriBuilder.php.

References UriBuilder\buildUri(), and FormProtectionFactory\get().

buildUriFromRoute (   $name,
  $parameters = array(),
  $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$nameThe name of the route
array$parametersAn array of parameters
string$referenceTypeThe type of reference to be generated (one of the constants)
Returns
Uri The generated Uri
Exceptions
RouteNotFoundExceptionIf the named route doesn't exist

Definition at line 69 of file backend/Classes/Routing/UriBuilder.php.

References UriBuilder\buildUri(), FormProtectionFactory\get(), and UriBuilder\loadBackendRoutes().

loadBackendRoutes ( )
protected

Fetches the available routes from the Router to be used for generating routes

Definition at line 51 of file backend/Classes/Routing/UriBuilder.php.

References GeneralUtility\makeInstance().

Referenced by UriBuilder\buildUriFromRoute().

Member Data Documentation

$routes
protected

Definition at line 46 of file backend/Classes/Routing/UriBuilder.php.

const ABSOLUTE_PATH = 'absolute'

Generates an absolute path

Definition at line 41 of file backend/Classes/Routing/UriBuilder.php.

const ABSOLUTE_URL = 'url'

Generates an absolute URL

Definition at line 36 of file backend/Classes/Routing/UriBuilder.php.