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.

Internal

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

Attributes
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

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

Properties

$configuration  : array<string|int, mixed>
Storage of the raw TypoScript configuration
$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<string|int, mixed>
Loads the Extbase Framework configuration.
getTypoScriptSetup()  : array<string|int, mixed>
Returns TypoScript Setup array from current Environment.
setConfiguration()  : void
Sets the specified raw configuration coming from the outside.
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<string|int, mixed>
Returns the TypoScript configuration found in config.tx_extbase
getPageChildrenRecursive()  : array<string|int, int>
Recursively fetch all children of a given page
getPluginConfiguration()  : array<string|int, mixed>
Returns the TypoScript configuration found in module.tx_yourextension_yourmodule merged with the global configuration of your extension from module.tx_yourextension
getRecursiveStoragePids()  : array<string|int, int>
Returns an array of storagePIDs that are below a list of storage pids.

Properties

$configuration

Storage of the raw TypoScript configuration

protected array<string|int, mixed> $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, SiteFinder $siteFinder, FrontendTypoScriptFactory $frontendTypoScriptFactory) : mixed
Parameters
$typoScriptService : TypoScriptService
$typoScriptCache : PhpFrontend
$runtimeCache : FrontendInterface
$sysTemplateRepository : SysTemplateRepository
$siteFinder : SiteFinder
$frontendTypoScriptFactory : FrontendTypoScriptFactory

getConfiguration()

Loads the Extbase Framework configuration.

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

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<string|int, mixed>

the Extbase framework configuration

getTypoScriptSetup()

Returns TypoScript Setup array from current Environment.

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

the raw TypoScript setup

setConfiguration()

Sets the specified raw configuration coming from the outside.

public setConfiguration([array<string|int, mixed> $configuration = [] ]) : void

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

Parameters
$configuration : array<string|int, mixed> = []

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() : int
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() : int
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<string|int, mixed>
Return values
array<string|int, mixed>

getPageChildrenRecursive()

Recursively fetch all children of a given page

protected getPageChildrenRecursive(int $pid, int $depth, int $begin, string $permsClause) : array<string|int, int>
Parameters
$pid : int

uid of the page

$depth : int
$begin : int
$permsClause : string
Return values
array<string|int, 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<string|int, mixed>
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<string|int, mixed>

getRecursiveStoragePids()

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

protected getRecursiveStoragePids(array<string|int, int> $storagePids[, int $recursionDepth = 0 ]) : array<string|int, int>
Parameters
$storagePids : array<string|int, 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
array<string|int, int>

Uid list including the start $storagePids


        
On this page

Search results