Settings
\nn\t3::Settings()
methods to simplify access to TypoScript setup, constants and PageTsConfig to simplify access.
Overview of Methods
\nn\t3::Settings()->addPageConfig($str = '');
Add page config
Alias to \nn\t3::Registry()->addPageConfig( $str );
\nn\t3::Settings()->addPageConfig( 'test.was = 10' );
\nn\t3::Settings()->addPageConfig( '' );
\nn\t3::Settings()->addPageConfig( '@import "EXT:extname/Configuration/TypoScript/page.ts"' );
| @return void
\nn\t3::Settings()->get($extensionName = '', $path = '');
Fetches the TypoScript setup and the "settings" section there.
Values from the FlexForm are not merged.
Alias to \nn\t3::Settings()->getSettings().
\nn\t3::Settings()->get( 'nnsite' );
\nn\t3::Settings()->get( 'nnsite', 'path.in.settings' );
| @return array
\nn\t3::Settings()->getCachedTyposcript();
High-performance version for initializing the TSFE in the backend. Get the complete TypoScript setup, incl. '.' syntax.
Is saved via file cache.
\nn\t3::Settings()->getCachedTyposcript();
| @return array
\nn\t3::Settings()->getConstants($tsPath = '');
Get array of TypoScript constants.
\nn\t3::Settings()->getConstants();
\nn\t3::Settings()->getConstants('path.to.constant');
Also exists as ViewHelper:
{nnt3:ts.constants(path:'path.to.constant')}
| @return array
\nn\t3::Settings()->getExtConf($extName = '');
Get extension configuration.
come from the LocalConfiguration.php, are defined via the extension settings
defined in the backend or ext_conf_template.txt
Earlier: $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['your_extension_key']
\nn\t3::Settings()->getExtConf( 'extname' );
| @return mixed
\nn\t3::Settings()->getFromPath($tsPath = '', $setup = NULL);
Get setup from a given path, e.g. 'plugin.tx_example.settings'
\nn\t3::Settings()->getFromPath('plugin.path');
\nn\t3::Settings()->getFromPath('L', \nn\t3::Request()->GP());
\nn\t3::Settings()->getFromPath('a.b', ['a'=>['b'=>1]]);
Also exists as ViewHelper:
{nnt3:ts.setup(path:'path.zur.setup')}
| @return array
\nn\t3::Settings()->getFullTypoScriptFromConfigurationManager();
Get complete TypoScript via the Configuration Manager.
A simple wrapper for the core function but with try { ... } catch()
Fallback.
Does not work in every context - e.g. not in the CLI context!
Better: \nn\t3::Settings()->parseTypoScriptForPage(); use.
Returns the notation with dots. This can be done via
| \nn\t3::TypoScript()->convertToPlainArray() into a normal array
be converted into a normal array.
// ==> ['plugin.']['example.'][...]
$setup = \nn\t3::Settings()->getFullTypoScriptFromConfigurationManager();
| @return array
| ➜ Go to source code of Settings::getFullTypoScriptFromConfigurationManager()
\nn\t3::Settings()->getFullTyposcript($pid = NULL);
Get the complete TypoScript setup, as a simple array - without "." syntax Works both in the frontend and backend, with and without passed pid
\nn\t3::Settings()->getFullTyposcript();
\nn\t3::Settings()->getFullTyposcript( $pid );
| @return array
\nn\t3::Settings()->getMergedSettings($extensionName = NULL, $ttContentUidOrSetupArray = []);
Get merge from TypoScript setup for a plugin and its flexform.
Returns the TypoScript array from plugin.tx_extname.settings... back.
Important: Only specify $extensionName if the setup of a FREMDEN extension is to be fetched or there is no controller context because the call is made from the backend... otherwise the FlexForm values are not taken into account!
In the FlexForm ``` use!
` in the TypoScript setup
| $ttContentUidOrSetupArray can be the uid of a tt_content content element
or a simple array to overwrite the values from the TypoScript / FlexForm
\nn\t3::Settings()->getMergedSettings();
\nn\t3::Settings()->getMergedSettings( 'nnsite' );
\nn\t3::Settings()->getMergedSettings( $extensionName, $ttContentUidOrSetupArray );
| @return array
\nn\t3::Settings()->getPageConfig($tsPath = '', $pid = NULL);
Get page configuration
\nn\t3::Settings()->getPageConfig();
\nn\t3::Settings()->getPageConfig('RTE.default.preset');
\nn\t3::Settings()->getPageConfig( $tsPath, $pid );
Also exists as ViewHelper:
{nnt3:ts.page(path:'path.to.pageconfig')}
| @return array
\nn\t3::Settings()->getPlugin($extName = NULL);
Get the setup for a specific plugin.
\nn\t3::Settings()->getPlugin('extname') returns TypoScript from plugin.tx_extname...
Important: Only specify $extensionName if the setup of a FREMDEN extension is to be fetched or there is no controller context because the call is made e.g. is made from the backend
| @return array
\nn\t3::Settings()->getSettings($extensionName = '', $path = '');
Fetches the TypoScript setup and the "settings" section there. Values from the FlexForm are not merged.
\nn\t3::Settings()->getSettings( 'nnsite' );
\nn\t3::Settings()->getSettings( 'nnsite', 'example.path' );
| @return array
\nn\t3::Settings()->getSiteConfig($request = NULL);
Get site configuration.
This is the configuration that has been defined in the YAML files in the /sites folder since TYPO3 9.
Some of the settings can also be set via the "Sites" page module.
In the context of a MiddleWare, the site may not yet be parsed / loaded.
In this case, the $request from the MiddleWare can be passed to determine the site.
$config = \nn\t3::Settings()->getSiteConfig();
$config = \nn\t3::Settings()->getSiteConfig( $request );
| @return array
\nn\t3::Settings()->getStoragePid($extName = NULL);
Get current (FIRST) StoragePid for the current plugin.
Saved in the TypoScript setup of the extension under
| plugin.tx_extname.persistence.storagePid or in the
FlexForm of the plugin on the respective page.
IMPORTANT: Merge with selected StoragePID from the FlexForm
only happens if $extNameis left empty.
\nn\t3::Settings()->getStoragePid(); // 123
\nn\t3::Settings()->getStoragePid('nnsite'); // 466
| @return string
\nn\t3::Settings()->getStoragePids($extName = NULL, $recursive = 0);
Get ALL storagePids for the current plugin.
Saved as a comma-separated list in the TypoScript setup of the extension under
| plugin.tx_extname.persistence.storagePid or in the
FlexForm of the plugin on the respective page.
IMPORTANT: Merge with selected StoragePID from the FlexForm
only happens if $extNameis left empty.
\nn\t3::Settings()->getStoragePids(); // [123, 466]
\nn\t3::Settings()->getStoragePids('nnsite'); // [123, 466]
Also get the child-PageUids?
| true takes the value for "Recursive" from the FlexForm or from the
TypoScript of the extension of plugin.tx_extname.persistence.recursive
\nn\t3::Settings()->getStoragePids(true); // [123, 466, 124, 467, 468]
\nn\t3::Settings()->getStoragePids('nnsite', true); // [123, 466, 124, 467, 468]
Alternatively, a numerical value can also be passed for the depth / recursion can also be passed.
\nn\t3::Settings()->getStoragePids(2); // [123, 466, 124, 467, 468]
\nn\t3::Settings()->getStoragePids('nnsite', 2); // [123, 466, 124, 467, 468]
| @return array
\nn\t3::Settings()->parseTypoScriptForPage($pageUid = 0, $request = NULL);
Parse TypoScript for specific pageUid.
Returns the notation with dots. This can be done via
| \nn\t3::TypoScript()->convertToPlainArray() into a normal array
be converted into a normal array.
// Get TypoScript for current pageUid
\nn\t3::Settings()->parseTypoScriptForPage();
// Get TypoScript for specific pageUid
\nn\t3::Settings()->parseTypoScriptForPage(123);
@param int $pid PageUid
@param ServerRequestInterface $request
@return array
\nn\t3::Settings()->setExtConf($extName = '', $key = '', $value = '');
Write extension configuration.
Writes an extension configuration in the LocalConfiguration.php. The values can also be
corresponding configuration in ext_conf_template.txt, the values can also be edited via the Extension Manager / the
Extension configuration in the backend.
\nn\t3::Settings()->setExtConf( 'extname', 'key', 'value' );
| @return mixed