‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (private readonly TypoScriptService $typoScriptService, #[Autowire(service:'cache.typoscript')] private readonly PhpFrontend $typoScriptCache, #[Autowire(service:'cache.runtime')] private readonly FrontendInterface $runtimeCache, private readonly SysTemplateRepository $sysTemplateRepository, private readonly SiteFinder $siteFinder, private readonly FrontendTypoScriptFactory $frontendTypoScriptFactory,)
 
 setRequest (ServerRequestInterface $request)
 
 setConfiguration (array $configuration=[])
 
array getConfiguration (?string $extensionName=null, ?string $pluginName=null)
 
array getTypoScriptSetup ()
 

Protected Member Functions

 getExtbaseConfiguration ()
 
 getPluginConfiguration (string $extensionName, ?string $pluginName=null)
 
int getCurrentPageId ()
 
int getCurrentPageIdFromRequest ()
 
int getCurrentPageIdFromCurrentSiteRoot ()
 
int getCurrentPageIdFromRootTemplate ()
 
int[] getRecursiveStoragePids (array $storagePids, int $recursionDepth=0)
 
int[] getPageChildrenRecursive (int $pid, int $depth, int $begin, string $permsClause)
 
 getBackendUser ()
 

Protected Attributes

array $configuration = []
 
string $extensionName = null
 
string $pluginName = null
 
int $currentPageId = null
 

Private Attributes

ServerRequestInterface $request = null
 

Detailed Description

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.

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

Definition at line 71 of file BackendConfigurationManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::__construct ( private readonly TypoScriptService  $typoScriptService,
# private readonly PhpFrontend  $typoScriptCache[Autowire(service:'cache.typoscript')],
# private readonly FrontendInterface  $runtimeCache[Autowire(service:'cache.runtime')],
private readonly SysTemplateRepository  $sysTemplateRepository,
private readonly SiteFinder  $siteFinder,
private readonly FrontendTypoScriptFactory  $frontendTypoScriptFactory 
)

Definition at line 99 of file BackendConfigurationManager.php.

Member Function Documentation

◆ getBackendUser()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getBackendUser ( )
protected

◆ getConfiguration()

array TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getConfiguration ( ?string  $extensionName = null,
?string  $pluginName = null 
)

Loads the Extbase Framework configuration.

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
string | null$extensionName‪if specified, the configuration for the given extension will be returned (plugin.tx_extensionname)
string | null$pluginName‪if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname)
Returns
‪array the Extbase framework configuration

Definition at line 138 of file BackendConfigurationManager.php.

References TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$extensionName, $GLOBALS, TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$pluginName, TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageId(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getExtbaseConfiguration(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getPluginConfiguration(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getRecursiveStoragePids(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\resetFrontendEnvironment(), and TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\simulateFrontendEnvironment().

◆ getCurrentPageId()

int TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getCurrentPageId ( )
protected

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"
Returns
‪int current page id. If no page is selected current root page id is returned

Definition at line 302 of file BackendConfigurationManager.php.

References TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$currentPageId, TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageIdFromCurrentSiteRoot(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageIdFromRequest(), and TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageIdFromRootTemplate().

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getConfiguration(), and TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getTypoScriptSetup().

◆ getCurrentPageIdFromCurrentSiteRoot()

int TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getCurrentPageIdFromCurrentSiteRoot ( )
protected

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

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

Definition at line 338 of file BackendConfigurationManager.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageId().

◆ getCurrentPageIdFromRequest()

int TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getCurrentPageIdFromRequest ( )
protected

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

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

Definition at line 319 of file BackendConfigurationManager.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageId().

◆ getCurrentPageIdFromRootTemplate()

int TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getCurrentPageIdFromRootTemplate ( )
protected

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

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

Definition at line 369 of file BackendConfigurationManager.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageId().

◆ getExtbaseConfiguration()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getExtbaseConfiguration ( )
protected

◆ getPageChildrenRecursive()

int [] TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getPageChildrenRecursive ( int  $pid,
int  $depth,
int  $begin,
string  $permsClause 
)
protected

Recursively fetch all children of a given page

Parameters
int$pid‪uid of the page
Returns
‪int[] List of child row $uid's

Definition at line 424 of file BackendConfigurationManager.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getRecursiveStoragePids().

◆ getPluginConfiguration()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getPluginConfiguration ( string  $extensionName,
?string  $pluginName = null 
)
protected

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

Parameters
string | null$pluginName‪in BE mode this is actually the module signature. But we're using it just like the plugin name in FE

Definition at line 276 of file BackendConfigurationManager.php.

References TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$extensionName, TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$pluginName, and TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getTypoScriptSetup().

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getConfiguration().

◆ getRecursiveStoragePids()

int [] TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getRecursiveStoragePids ( array  $storagePids,
int  $recursionDepth = 0 
)
protected

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

Parameters
int[]$storagePids‪Storage PIDs to start at; multiple PIDs possible as comma-separated list
int$recursionDepth‪Maximum number of levels to search, 0 to disable recursive lookup
Returns
‪int[] Uid list including the start $storagePids

Definition at line 398 of file BackendConfigurationManager.php.

References TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getBackendUser(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getPageChildrenRecursive(), TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW, and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getConfiguration().

◆ getTypoScriptSetup()

array TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::getTypoScriptSetup ( )

◆ setConfiguration()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::setConfiguration ( array  $configuration = [])

Sets the specified raw configuration coming from the outside. Note that this is a low level method and only makes sense to be used by Extbase internally.

Parameters
array$configuration‪The new configuration

Definition at line 121 of file BackendConfigurationManager.php.

References TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\$configuration.

◆ setRequest()

TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::setRequest ( ServerRequestInterface  $request)

Member Data Documentation

◆ $configuration

array TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::$configuration = []
protected

Storage of the raw TypoScript configuration

Definition at line 76 of file BackendConfigurationManager.php.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\setConfiguration().

◆ $currentPageId

int TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::$currentPageId = null
protected

Stores the current page ID

Definition at line 91 of file BackendConfigurationManager.php.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getCurrentPageId().

◆ $extensionName

string TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::$extensionName = null
protected

◆ $pluginName

string TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::$pluginName = null
protected

◆ $request

ServerRequestInterface TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::$request = null
private
Todo:
‪: In CLI context, BE configuration manager might be triggered without request. See comment on this in ConfigurationManager.

Definition at line 97 of file BackendConfigurationManager.php.

Referenced by TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getTypoScriptSetup(), and TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\setRequest().