UriBuilder

URI Builder for extbase requests.

Attributes
#[Autoconfigure]
$public: true
$shared: false

Table of Contents

Properties

$absoluteUriScheme  : string|null
$addQueryString  : bool|string|int
$argumentPrefix  : string|null
$arguments  : array<string|int, mixed>
$argumentsToBeExcludedFromQueryString  : array<string|int, mixed>
$createAbsoluteUri  : bool
$extensionService  : ExtensionService
$format  : string
$language  : string|null
$lastArguments  : array<string|int, mixed>
$linkAccessRestrictedPages  : bool
$noCache  : bool
$request  : RequestInterface
$section  : string
$targetPageType  : int
$targetPageUid  : int|null

Methods

__construct()  : mixed
build()  : string
Builds the URI Depending on the current context this calls buildBackendUri() or buildFrontendUri()
buildBackendUri()  : string
Builds the URI, backend flavour The settings pageUid, pageType, noCache & linkAccessRestrictedPages will be ignored in the backend.
buildFrontendUri()  : string
Builds the URI, frontend flavour
getAbsoluteUriScheme()  : string|null
getAddQueryString()  : bool|string|int
getArgumentPrefix()  : string|null
getArguments()  : array<string|int, mixed>
getArgumentsToBeExcludedFromQueryString()  : array<string|int, mixed>
getCreateAbsoluteUri()  : bool
getFormat()  : string
getLanguage()  : string|null
getLastArguments()  : array<string|int, mixed>
Returns the arguments being used for the last URI being built.
getLinkAccessRestrictedPages()  : bool
getNoCache()  : bool
getSection()  : string
getTargetPageType()  : int
getTargetPageUid()  : int|null
reset()  : static
Resets all UriBuilder options to their default value
setAbsoluteUriScheme()  : static
Sets the scheme that should be used for absolute URIs in FE mode
setAddQueryString()  : static
If set, the current query parameters will be merged with $this->arguments in backend context.
setArgumentPrefix()  : static
Specifies the prefix to be used for all arguments.
setArguments()  : static
Additional query parameters.
setArgumentsToBeExcludedFromQueryString()  : static
A list of arguments to be excluded from the query parameters Only active if addQueryString is set
setCreateAbsoluteUri()  : static
If set, the URI is prepended with the current base URI. Defaults to FALSE.
setFormat()  : static
Specifies the format of the target (e.g. "html" or "xml")
setLanguage()  : UriBuilder
Enforces a URI / link to a page to a specific language (or use "current")
setLinkAccessRestrictedPages()  : static
If set, URIs for pages without access permissions will be created
setNoCache()  : static
by default FALSE; if TRUE, &no_cache=1 will be appended to the URI
setRequest()  : static
Sets the current request
setSection()  : static
If specified, adds a given HTML anchor to the URI (#...)
setTargetPageType()  : static
Sets the page type of the target URI. Defaults to 0
setTargetPageUid()  : static
Uid of the target page
uriFor()  : string
Creates a URI used for linking to an Extbase action.
buildTypolinkConfiguration()  : array<string|int, mixed>
Builds a TypoLink configuration array from the current settings
convertDomainObjectsToIdentityArrays()  : array<string|int, mixed>
Recursively iterates through the specified arguments and turns instances of type \TYPO3\CMS\Extbase\DomainObject\AbstractEntity into an arrays containing the uid of the domain object.
convertIteratorToArray()  : array<string|int, mixed>
convertTransientObjectToArray()  : array<string|int, mixed>
Converts a given object recursively into an array.

Properties

$absoluteUriScheme

protected string|null $absoluteUriScheme = null

$addQueryString

protected bool|string|int $addQueryString = false

$argumentPrefix

protected string|null $argumentPrefix = null

$arguments

protected array<string|int, mixed> $arguments = []

$argumentsToBeExcludedFromQueryString

protected array<string|int, mixed> $argumentsToBeExcludedFromQueryString = []

$createAbsoluteUri

protected bool $createAbsoluteUri = false

$language

protected string|null $language = null

$lastArguments

protected array<string|int, mixed> $lastArguments = []

$linkAccessRestrictedPages

protected bool $linkAccessRestrictedPages = false

$targetPageType

protected int $targetPageType = 0

$targetPageUid

protected int|null $targetPageUid = null

Methods

build()

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

public build() : string
Tags
see
buildBackendUri()
see
buildFrontendUri()
Return values
string —

The URI

buildBackendUri()

Builds the URI, backend flavour The settings pageUid, pageType, noCache & linkAccessRestrictedPages will be ignored in the backend.

public buildBackendUri() : string
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string —

The URI

buildFrontendUri()

Builds the URI, frontend flavour

public buildFrontendUri() : string
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
see
buildTypolinkConfiguration()
Return values
string —

The URI

getAbsoluteUriScheme()

public getAbsoluteUriScheme() : string|null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string|null

getAddQueryString()

public getAddQueryString() : bool|string|int
Internal
Return values
bool|string|int

getArgumentPrefix()

public getArgumentPrefix() : string|null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string|null

getArguments()

public getArguments() : array<string|int, mixed>
Internal
Return values
array<string|int, mixed>

getArgumentsToBeExcludedFromQueryString()

public getArgumentsToBeExcludedFromQueryString() : array<string|int, mixed>
Internal
Return values
array<string|int, mixed>

getCreateAbsoluteUri()

public getCreateAbsoluteUri() : bool
Internal
Return values
bool

getFormat()

public getFormat() : string
Internal
Return values
string

getLanguage()

public getLanguage() : string|null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string|null

getLastArguments()

Returns the arguments being used for the last URI being built.

public getLastArguments() : array<string|int, mixed>

This is only set after build() / uriFor() has been called.

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
array<string|int, mixed> —

The last arguments

getLinkAccessRestrictedPages()

public getLinkAccessRestrictedPages() : bool
Internal
Return values
bool

getNoCache()

public getNoCache() : bool
Internal
Return values
bool

getSection()

public getSection() : string
Internal
Return values
string

getTargetPageType()

public getTargetPageType() : int
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
int

getTargetPageUid()

public getTargetPageUid() : int|null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
int|null

reset()

Resets all UriBuilder options to their default value

public reset() : static
Return values
static —

the current UriBuilder to allow method chaining

setAbsoluteUriScheme()

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

public setAbsoluteUriScheme(string $absoluteUriScheme) : static
Parameters
$absoluteUriScheme : string

the scheme to be used for absolute URIs

Return values
static —

the current UriBuilder to allow method chaining

setAddQueryString()

If set, the current query parameters will be merged with $this->arguments in backend context.

public setAddQueryString(bool|string|int $addQueryString) : static

In frontend context, setting this property will only include mapped query arguments from the Page Routing. To include any - possible "unsafe" - GET parameters, the property has to be set to "untrusted". Defaults to FALSE.

Parameters
$addQueryString : bool|string|int

is set to "1", "true", "0", "false" or "untrusted"

Tags
see
https://docs.typo3.org/permalink/t3tsref:confval-typolink-addquerystring
Return values
static —

the current UriBuilder to allow method chaining

setArgumentPrefix()

Specifies the prefix to be used for all arguments.

public setArgumentPrefix(string $argumentPrefix) : static
Parameters
$argumentPrefix : string
Return values
static —

the current UriBuilder to allow method chaining

setArguments()

Additional query parameters.

public setArguments(array<string|int, mixed> $arguments) : static

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

Parameters
$arguments : array<string|int, mixed>
Return values
static —

the current UriBuilder to allow method chaining

setArgumentsToBeExcludedFromQueryString()

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

public setArgumentsToBeExcludedFromQueryString(array<string|int, mixed> $argumentsToBeExcludedFromQueryString) : static
Parameters
$argumentsToBeExcludedFromQueryString : array<string|int, mixed>
Tags
see
https://docs.typo3.org/permalink/t3tsref:confval-typolink-addquerystring
see
setAddQueryString()
Return values
static —

the current UriBuilder to allow method chaining

setCreateAbsoluteUri()

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

public setCreateAbsoluteUri(bool $createAbsoluteUri) : static
Parameters
$createAbsoluteUri : bool
Return values
static —

the current UriBuilder to allow method chaining

setFormat()

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

public setFormat(string $format) : static
Parameters
$format : string
Return values
static —

the current UriBuilder to allow method chaining

setLanguage()

Enforces a URI / link to a page to a specific language (or use "current")

public setLanguage(string|null $language) : UriBuilder
Parameters
$language : string|null
Return values
UriBuilder

setLinkAccessRestrictedPages()

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

public setLinkAccessRestrictedPages(bool $linkAccessRestrictedPages) : static
Parameters
$linkAccessRestrictedPages : bool
Return values
static —

the current UriBuilder to allow method chaining

setNoCache()

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

public setNoCache(bool $noCache) : static
Parameters
$noCache : bool
Return values
static —

the current UriBuilder to allow method chaining

setRequest()

Sets the current request

public setRequest(RequestInterface $request) : static
Parameters
$request : RequestInterface
Return values
static —

the current UriBuilder to allow method chaining

setSection()

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

public setSection(string $section) : static
Parameters
$section : string
Return values
static —

the current UriBuilder to allow method chaining

setTargetPageType()

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

public setTargetPageType(int $targetPageType) : static
Parameters
$targetPageType : int
Return values
static —

the current UriBuilder to allow method chaining

setTargetPageUid()

Uid of the target page

public setTargetPageUid(int $targetPageUid) : static
Parameters
$targetPageUid : int
Return values
static —

the current UriBuilder to allow method chaining

uriFor()

Creates a URI used for linking to an Extbase action.

public uriFor([string|null $actionName = null ][, array<string|int, mixed>|null $controllerArguments = null ][, string|null $controllerName = null ][, string|null $extensionName = null ][, string|null $pluginName = null ]) : string

Works in Frontend and Backend mode of TYPO3.

Parameters
$actionName : string|null = null

Name of the action to be called

$controllerArguments : array<string|int, mixed>|null = null

Additional query parameters. Will be "namespaced" and merged with $this->arguments.

$controllerName : string|null = null

Name of the target controller. If not set, current ControllerName is used.

$extensionName : string|null = null

Name of the target extension, without underscores. If not set, current ExtensionName is used.

$pluginName : string|null = null

Name of the target plugin. If not set, current PluginName is used.

Tags
see
build()
Return values
string —

the rendered URI

buildTypolinkConfiguration()

Builds a TypoLink configuration array from the current settings

protected buildTypolinkConfiguration() : array<string|int, mixed>
Tags
see
https://docs.typo3.org/permalink/t3tsref:typolink
Return values
array<string|int, mixed> —

typolink configuration array

convertDomainObjectsToIdentityArrays()

Recursively iterates through the specified arguments and turns instances of type \TYPO3\CMS\Extbase\DomainObject\AbstractEntity into an arrays containing the uid of the domain object.

protected convertDomainObjectsToIdentityArrays(array<string|int, mixed> $arguments) : array<string|int, mixed>
Parameters
$arguments : array<string|int, mixed>

The arguments to be iterated

Tags
throws
InvalidArgumentValueException
Return values
array<string|int, mixed> —

The modified arguments array

convertIteratorToArray()

protected convertIteratorToArray(Iterator $iterator) : array<string|int, mixed>
Parameters
$iterator : Iterator
Return values
array<string|int, mixed>

convertTransientObjectToArray()

Converts a given object recursively into an array.

protected convertTransientObjectToArray(DomainObjectInterface $object) : array<string|int, mixed>
Parameters
$object : DomainObjectInterface
Tags
todo

Refactor this into convertDomainObjectsToIdentityArrays()

Return values
array<string|int, mixed>
On this page

Search results