TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
UriBuilder Class Reference

Public Member Functions

 injectConfigurationManager (\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 
 injectExtensionService (\TYPO3\CMS\Extbase\Service\ExtensionService $extensionService)
 
 injectEnvironmentService (\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService)
 
 initializeObject ()
 
 setRequest (Request $request)
 
 getRequest ()
 
 setArguments (array $arguments)
 
 getArguments ()
 
 setSection ($section)
 
 getSection ()
 
 setFormat ($format)
 
 getFormat ()
 
 setCreateAbsoluteUri ($createAbsoluteUri)
 
 getCreateAbsoluteUri ()
 
 getAbsoluteUriScheme ()
 
 setAbsoluteUriScheme ($absoluteUriScheme)
 
 setAddQueryString ($addQueryString)
 
 getAddQueryString ()
 
 setAddQueryStringMethod ($addQueryStringMethod)
 
 getAddQueryStringMethod ()
 
 setArgumentsToBeExcludedFromQueryString (array $argumentsToBeExcludedFromQueryString)
 
 getArgumentsToBeExcludedFromQueryString ()
 
 setArgumentPrefix ($argumentPrefix)
 
 getArgumentPrefix ()
 
 setLinkAccessRestrictedPages ($linkAccessRestrictedPages)
 
 getLinkAccessRestrictedPages ()
 
 setTargetPageUid ($targetPageUid)
 
 getTargetPageUid ()
 
 setTargetPageType ($targetPageType)
 
 getTargetPageType ()
 
 setNoCache ($noCache)
 
 getNoCache ()
 
 setUseCacheHash ($useCacheHash)
 
 getUseCacheHash ()
 
 getLastArguments ()
 
 reset ()
 
 uriFor ($actionName=null, $controllerArguments=[], $controllerName=null, $extensionName=null, $pluginName=null)
 
 build ()
 
 buildBackendUri ()
 
 buildFrontendUri ()
 
 convertTransientObjectToArray (\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object)
 

Protected Member Functions

 removeDefaultControllerAndAction (array $controllerArguments, $extensionName, $pluginName)
 
 buildTypolinkConfiguration ()
 
 convertDomainObjectsToIdentityArrays (array $arguments)
 
 convertIteratorToArray (\Iterator $iterator)
 

Protected Attributes

 $configurationManager
 
 $extensionService
 
 $contentObject
 
 $request
 
 $arguments = []
 
 $lastArguments = []
 
 $section = ''
 
 $createAbsoluteUri = false
 
 $absoluteUriScheme = null
 
 $addQueryString = false
 
 $addQueryStringMethod = null
 
 $argumentsToBeExcludedFromQueryString = []
 
 $linkAccessRestrictedPages = false
 
 $targetPageUid = null
 
 $targetPageType = 0
 
 $noCache = false
 
 $useCacheHash = true
 
 $format = ''
 
 $argumentPrefix = null
 
 $environmentService
 

Detailed Description

An URI Builder

Definition at line 27 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

Member Function Documentation

build ( )

Builds the URI Depending on the current context this calls buildBackendUri() or buildFrontendUri()

Returns
string The URI
See also
buildBackendUri()
buildFrontendUri()

Definition at line 623 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\buildBackendUri(), and UriBuilder\buildFrontendUri().

Referenced by UriBuilder\uriFor().

buildBackendUri ( )

Builds the URI, backend flavour The resulting URI is relative and starts with "index.php". The settings pageUid, pageType, noCache, useCacheHash & linkAccessRestrictedPages will be ignored in the backend.

Returns
string The URI

Definition at line 640 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$arguments, UriBuilder\$section, GeneralUtility\_GET(), GeneralUtility\_GP(), GeneralUtility\_POST(), ArrayUtility\arrayDiffAssocRecursive(), UriBuilder\convertDomainObjectsToIdentityArrays(), GeneralUtility\explodeUrl2Array(), GeneralUtility\getIndpEnv(), GeneralUtility\makeInstance(), and ArrayUtility\mergeRecursiveWithOverrule().

Referenced by UriBuilder\build().

buildFrontendUri ( )

Builds the URI, frontend flavour

Returns
string The URI
See also
buildTypolinkConfiguration()

Definition at line 696 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$absoluteUriScheme, and UriBuilder\buildTypolinkConfiguration().

Referenced by UriBuilder\build().

buildTypolinkConfiguration ( )
protected

Builds a TypoLink configuration array from the current settings

Returns
array typolink configuration array
See also
TSref/typolink

Definition at line 715 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$addQueryStringMethod, UriBuilder\$arguments, UriBuilder\$format, $GLOBALS, UriBuilder\$section, UriBuilder\$targetPageType, UriBuilder\convertDomainObjectsToIdentityArrays(), and GeneralUtility\implodeArrayForUrl().

Referenced by UriBuilder\buildFrontendUri().

convertDomainObjectsToIdentityArrays ( array  $arguments)
protected

Recursively iterates through the specified arguments and turns instances of type into an arrays containing the uid of the domain object.

Parameters
array$argumentsThe arguments to be iterated
Exceptions
TYPO3
Returns
array The modified arguments array

Definition at line 763 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$arguments, UriBuilder\convertIteratorToArray(), and UriBuilder\convertTransientObjectToArray().

Referenced by UriBuilder\buildBackendUri(), UriBuilder\buildTypolinkConfiguration(), and UriBuilder\convertTransientObjectToArray().

convertIteratorToArray ( \Iterator  $iterator)
protected
Parameters
\Iterator$iterator
Returns
array

Definition at line 795 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

Referenced by UriBuilder\convertDomainObjectsToIdentityArrays(), and UriBuilder\convertTransientObjectToArray().

convertTransientObjectToArray ( \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject  $object)

Converts a given object recursively into an array.

Parameters
\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject$object
Returns
array
Todo:
Refactore this into convertDomainObjectsToIdentityArrays()

Definition at line 812 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\convertDomainObjectsToIdentityArrays(), and UriBuilder\convertIteratorToArray().

Referenced by UriBuilder\convertDomainObjectsToIdentityArrays().

getAbsoluteUriScheme ( )
Returns
string

Definition at line 280 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$absoluteUriScheme.

getAddQueryString ( )
Returns
bool

Definition at line 315 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$addQueryString.

getAddQueryStringMethod ( )
Returns
string

Definition at line 339 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$addQueryStringMethod.

getArgumentPrefix ( )
Returns
string

Definition at line 384 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$argumentPrefix.

getArguments ( )
Returns
array

Definition at line 206 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$arguments.

getArgumentsToBeExcludedFromQueryString ( )
getCreateAbsoluteUri ( )
Returns
bool

Definition at line 272 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$createAbsoluteUri.

getFormat ( )
Returns
string

Definition at line 250 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$format.

getLastArguments ( )

Returns the arguments being used for the last URI being built. This is only set after build() / uriFor() has been called.

Returns
array The last arguments

Definition at line 508 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$lastArguments.

getLinkAccessRestrictedPages ( )
getNoCache ( )
Returns
bool

Definition at line 474 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$noCache.

getRequest ( )
Returns
Request

Definition at line 182 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$request.

getSection ( )
Returns
string

Definition at line 228 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$section.

getTargetPageType ( )
Returns
int

Definition at line 451 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$targetPageType.

getTargetPageUid ( )

returns $this->targetPageUid.

Returns
int

Definition at line 430 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$targetPageUid.

getUseCacheHash ( )
Returns
bool

Definition at line 497 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$useCacheHash.

initializeObject ( )

Life-cycle method that is called by the DI container as soon as this object is completely built

Returns
void

Definition at line 162 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

injectConfigurationManager ( \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface  $configurationManager)
Parameters
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface$configurationManager

Definition at line 136 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$configurationManager.

injectEnvironmentService ( \TYPO3\CMS\Extbase\Service\EnvironmentService  $environmentService)
Parameters
\TYPO3\CMS\Extbase\Service\EnvironmentService$environmentService

Definition at line 152 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$environmentService.

injectExtensionService ( \TYPO3\CMS\Extbase\Service\ExtensionService  $extensionService)
Parameters
\TYPO3\CMS\Extbase\Service\ExtensionService$extensionService

Definition at line 144 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$extensionService.

removeDefaultControllerAndAction ( array  $controllerArguments,
  $extensionName,
  $pluginName 
)
protected

This removes controller and/or action arguments from given controllerArguments if they are equal to the default controller/action of the target plugin. Note: This is only active in FE mode and if feature "skipDefaultArguments" is enabled

See also
::isFeatureEnabled()
Parameters
array$controllerArgumentsthe current controller arguments to be modified
string$extensionNametarget extension name
string$pluginNametarget plugin name
Returns
array

Definition at line 599 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

Referenced by UriBuilder\uriFor().

reset ( )

Resets all UriBuilder options to their default value

Returns
the current UriBuilder to allow method chaining

Definition at line 519 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

setAbsoluteUriScheme (   $absoluteUriScheme)

Sets the scheme that should be used for absolute URIs in FE mode

Parameters
string$absoluteUriSchemethe scheme to be used for absolute URIs
Returns
the current UriBuilder to allow method chaining

Definition at line 291 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$absoluteUriScheme.

setAddQueryString (   $addQueryString)

If set, the current query parameters will be merged with $this->arguments. Defaults to FALSE.

Parameters
bool$addQueryString
Returns
the current UriBuilder to allow method chaining
See also
TSref/typolink.addQueryString

Definition at line 305 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$addQueryString.

setAddQueryStringMethod (   $addQueryStringMethod)

Sets the method to get the addQueryString parameters. Defaults undefined which results in using QUERY_STRING.

Parameters
string$addQueryStringMethod
Returns
the current UriBuilder to allow method chaining
See also
TSref/typolink.addQueryString.method

Definition at line 329 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$addQueryStringMethod.

setArgumentPrefix (   $argumentPrefix)

Specifies the prefix to be used for all arguments.

Parameters
string$argumentPrefix
Returns
the current UriBuilder to allow method chaining

Definition at line 375 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$argumentPrefix.

setArguments ( array  $arguments)

Additional query parameters. If you want to "prefix" arguments, you can pass in multidimensional arrays: array('prefix1' => array('foo' => 'bar')) gets "&prefix1[foo]=bar"

Parameters
array$arguments
Returns
the current UriBuilder to allow method chaining

Definition at line 196 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$arguments.

setArgumentsToBeExcludedFromQueryString ( array  $argumentsToBeExcludedFromQueryString)

A list of arguments to be excluded from the query parameters Only active if addQueryString is set

Parameters
array$argumentsToBeExcludedFromQueryString
Returns
the current UriBuilder to allow method chaining
See also
TSref/typolink.addQueryString.exclude
setAddQueryString()

Definition at line 354 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$argumentsToBeExcludedFromQueryString.

setCreateAbsoluteUri (   $createAbsoluteUri)

If set, the URI is prepended with the current base URI. Defaults to FALSE.

Parameters
bool$createAbsoluteUri
Returns
the current UriBuilder to allow method chaining

Definition at line 262 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$createAbsoluteUri.

setFormat (   $format)

Specifies the format of the target (e.g. "html" or "xml")

Parameters
string$format
Returns
the current UriBuilder to allow method chaining

Definition at line 240 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$format.

setLinkAccessRestrictedPages (   $linkAccessRestrictedPages)

If set, URIs for pages without access permissions will be created

Parameters
bool$linkAccessRestrictedPages
Returns
the current UriBuilder to allow method chaining

Definition at line 396 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$linkAccessRestrictedPages.

setNoCache (   $noCache)

by default FALSE; if TRUE, &no_cache=1 will be appended to the URI This overrules the useCacheHash setting

Parameters
bool$noCache
Returns
the current UriBuilder to allow method chaining

Definition at line 464 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$noCache.

setRequest ( Request  $request)

Sets the current request

Parameters
Request$request
Returns
the current UriBuilder to allow method chaining

Definition at line 173 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$request.

setSection (   $section)

If specified, adds a given HTML anchor to the URI (#...)

Parameters
string$section
Returns
the current UriBuilder to allow method chaining

Definition at line 218 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$section.

setTargetPageType (   $targetPageType)

Sets the page type of the target URI. Defaults to 0

Parameters
int$targetPageType
Returns
the current UriBuilder to allow method chaining

Definition at line 442 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$targetPageType.

setTargetPageUid (   $targetPageUid)

Uid of the target page

Parameters
int$targetPageUid
Returns
the current UriBuilder to allow method chaining

Definition at line 418 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$targetPageUid.

setUseCacheHash (   $useCacheHash)

by default TRUE; if FALSE, no cHash parameter will be appended to the URI If noCache is set, this setting will be ignored.

Parameters
bool$useCacheHash
Returns
the current UriBuilder to allow method chaining

Definition at line 487 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$useCacheHash.

uriFor (   $actionName = null,
  $controllerArguments = [],
  $controllerName = null,
  $extensionName = null,
  $pluginName = null 
)

Creates an URI used for linking to an Extbase action. Works in Frontend and Backend mode of TYPO3.

Parameters
string$actionNameName of the action to be called
array$controllerArgumentsAdditional query parameters. Will be "namespaced" and merged with $this->arguments.
string$controllerNameName of the target controller. If not set, current ControllerName is used.
string$extensionNameName of the target extension, without underscores. If not set, current ExtensionName is used.
string$pluginNameName of the target plugin. If not set, current PluginName is used.
Returns
string the rendered URI
See also
build()

Definition at line 550 of file extbase/Classes/Mvc/Web/Routing/UriBuilder.php.

References UriBuilder\$format, UriBuilder\build(), ArrayUtility\mergeRecursiveWithOverrule(), and UriBuilder\removeDefaultControllerAndAction().

Member Data Documentation

$addQueryString = false
protected
$argumentPrefix = null
protected
$argumentsToBeExcludedFromQueryString = []
protected
$configurationManager
protected
$contentObject
protected
$createAbsoluteUri = false
protected
$environmentService
protected
$extensionService
protected
$lastArguments = []
protected
$linkAccessRestrictedPages = false
protected
$noCache = false
protected
$request
protected
$targetPageUid = null
protected
$useCacheHash = true
protected