BackendConfigurationManager

class \TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager

Implements
SingletonInterface

Load TypoScript of a page in backend mode.

Extbase Backend modules can be configured with Frontend TypoScript. This is of course a very bad thing, but it is how it is ^^ (we'll get rid of this at some point, promised!)

First, this means Backend extbase module performance scales with the amount of Frontend TypoScript. Furthermore, in contrast to Frontend, Backend Modules are not necessarily bound to pages in the first place - they may not have a page tree und thus no page id at all, like for instance the ext:beuser module.

Unfortunately, extbase still has to calculate some TypoScript in any case, even if there is no page id at all: The default configuration of extbase Backend modules is the "module." TypoScript setup top-level key. The base config of this is delivered by extbase extensions that have Backend Modules using ext_typoscript_setup.typoscript, and/or via TYPO3_CONF_VARS TypoScript setup defaults. Those have to be loaded in any case, even if there is no page at all in the page tree.

The code thus has to hop through quite some loops to "find" some relevant page id it can guess if none is incoming from the request. It even fakes a default sys_template row to trigger TypoScript loading of globals and ext_typoscript_setup.typoscript if it couldn't find anything.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$configuration  : array
Storage of the raw TypoScript configuration
$contentObject  : ContentObjectRenderer|null
$currentPageId  : int|null
Stores the current page ID
$extensionName  : string|null
Name of the extension this Configuration Manager instance belongs to
$pluginName  : string|null
Name of the plugin this Configuration Manager instance belongs to

Methods

__construct()  : mixed
getConfiguration()  : array
Loads the Extbase Framework configuration.
getContentObject()  : ContentObjectRenderer
getTypoScriptSetup()  : array
Returns TypoScript Setup array from current Environment.
setConfiguration()  : void
Sets the specified raw configuration coming from the outside.
setContentObject()  : void
setRequest()  : void
getBackendUser()  : BackendUserAuthentication
getCurrentPageId()  : int
The full madness to guess a page id: - First try to get one from the request, accessing POST / GET 'id' - else, fetch the first page in page tree that has 'is_siteroot' set - else, fetch the first sys_template record that has 'root' flag set, and use its pid - else, 0, indicating "there are no 'is_siteroot' pages and no sys_template 'root' records"
getCurrentPageIdFromCurrentSiteRoot()  : int
Gets the current page ID from the first site root in tree.
getCurrentPageIdFromRequest()  : int
Gets the current page ID from the GET/POST data.
getCurrentPageIdFromRootTemplate()  : int
Gets the current page ID from the first created root template.
getExtbaseConfiguration()  : array
Returns the TypoScript configuration found in config.tx_extbase
getPageChildrenRecursive()  : int[]
Recursively fetch all children of a given page
getPluginConfiguration()  : array
Returns the TypoScript configuration found in module.tx_yourextension_yourmodule merged with the global configuration of your extension from module.tx_yourextension
getRecursiveStoragePids()  : int[]
Returns an array of storagePIDs that are below a list of storage pids.

Properties

$configuration

Storage of the raw TypoScript configuration

protected array $configuration = []

$currentPageId

Stores the current page ID

protected int|null $currentPageId = null

$extensionName

Name of the extension this Configuration Manager instance belongs to

protected string|null $extensionName = null

$pluginName

Name of the plugin this Configuration Manager instance belongs to

protected string|null $pluginName = null

Methods

__construct()

public __construct(TypoScriptService $typoScriptService, PhpFrontend $typoScriptCache, FrontendInterface $runtimeCache, SysTemplateRepository $sysTemplateRepository, SysTemplateTreeBuilder $treeBuilder, LossyTokenizer $lossyTokenizer, ConditionVerdictAwareIncludeTreeTraverser $includeTreeTraverserConditionVerdictAware, SiteFinder $siteFinder) : mixed

Parameters

$typoScriptService : TypoScriptService
$typoScriptCache : PhpFrontend
$runtimeCache : FrontendInterface
$sysTemplateRepository : SysTemplateRepository
$treeBuilder : SysTemplateTreeBuilder
$lossyTokenizer : LossyTokenizer
$includeTreeTraverserConditionVerdictAware : ConditionVerdictAwareIncludeTreeTraverser
$siteFinder : SiteFinder

getConfiguration()

Loads the Extbase Framework configuration.

public getConfiguration([string|null $extensionName = null ][, string|null $pluginName = null ]) : array

The Extbase framework configuration HAS TO be retrieved using this method, as they are come from different places than the normal settings. Framework configuration is, in contrast to normal settings, needed for the Extbase framework to operate correctly.

Parameters

$extensionName : string|null = null

if specified, the configuration for the given extension will be returned (plugin.tx_extensionname)

$pluginName : string|null = null

if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname)

Return values

array —

the Extbase framework configuration

getTypoScriptSetup()

Returns TypoScript Setup array from current Environment.

public getTypoScriptSetup() : array

Return values

array —

the raw TypoScript setup

setConfiguration()

Sets the specified raw configuration coming from the outside.

public setConfiguration([array $configuration = [] ]) : void

Note that this is a low level method and only makes sense to be used by Extbase internally.

Parameters

$configuration : array = []

The new configuration

setRequest()

public setRequest(ServerRequestInterface $request) : void

Parameters

$request : ServerRequestInterface

getCurrentPageId()

The full madness to guess a page id: - First try to get one from the request, accessing POST / GET 'id' - else, fetch the first page in page tree that has 'is_siteroot' set - else, fetch the first sys_template record that has 'root' flag set, and use its pid - else, 0, indicating "there are no 'is_siteroot' pages and no sys_template 'root' records"

protected getCurrentPageId([ServerRequestInterface|null $request = null ]) : int

Parameters

$request : ServerRequestInterface|null = null

Return values

int —

current page id. If no page is selected current root page id is returned

getCurrentPageIdFromCurrentSiteRoot()

Gets the current page ID from the first site root in tree.

protected getCurrentPageIdFromCurrentSiteRoot() : int

Return values

int —

the page UID, will be 0 if none has been set

getCurrentPageIdFromRequest()

Gets the current page ID from the GET/POST data.

protected getCurrentPageIdFromRequest(ServerRequestInterface $request) : int

Parameters

$request : ServerRequestInterface

Return values

int —

the page UID, will be 0 if none has been set

getCurrentPageIdFromRootTemplate()

Gets the current page ID from the first created root template.

protected getCurrentPageIdFromRootTemplate() : int

Return values

int —

the page UID, will be 0 if none has been set

getExtbaseConfiguration()

Returns the TypoScript configuration found in config.tx_extbase

protected getExtbaseConfiguration() : array

Return values

array

getPageChildrenRecursive()

Recursively fetch all children of a given page

protected getPageChildrenRecursive(int $pid, int $depth, int $begin, string $permsClause) : int[]

Parameters

$pid : int

uid of the page

$depth : int
$begin : int
$permsClause : string

Return values

int[] —

List of child row $uid's

getPluginConfiguration()

Returns the TypoScript configuration found in module.tx_yourextension_yourmodule merged with the global configuration of your extension from module.tx_yourextension

protected getPluginConfiguration(string $extensionName[, string|null $pluginName = null ]) : array

Parameters

$extensionName : string
$pluginName : string|null = null

in BE mode this is actually the module signature. But we're using it just like the plugin name in FE

Return values

array

getRecursiveStoragePids()

Returns an array of storagePIDs that are below a list of storage pids.

protected getRecursiveStoragePids(int[] $storagePids[, int $recursionDepth = 0 ]) : int[]

Parameters

$storagePids : int[]

Storage PIDs to start at; multiple PIDs possible as comma-separated list

$recursionDepth : int = 0

Maximum number of levels to search, 0 to disable recursive lookup

Return values

int[] —

Uid list including the start $storagePids

On this page