Feature: #99048 - Site settings read API¶
See forge#99048
Description¶
Settings for site-specific functionality can now be retrieved by a dedicated
\TYPO3\CMS\Core\Site\Entity\SiteSettings
object, accessible via a
\TYPO3\CMS\Core\Site\Entity\Site
object like $site->getSettings()
.
Settings can be used in custom frontend code to deliver features which might vary per-site for extensions.
Impact¶
Accessing site settings, which was previously possible via:
$site->getConfiguration()['settings']['redirects'] ?? []
in custom PHP code, is now easier via the SiteSettings
PHP object.
The SiteSettings
object can be used to access settings either by
the dot notation ("flat", a default value can be given as optional second
argument), e.g.:
$redirectStatusCode = (int)$siteSettings->get('redirects.httpStatusCode', 307);
or by accessing all options for a certain group:
$allSettingsRelatedToRedirects = $siteSettings->get('redirects');
or even fetching all settings:
$allSettings = $siteSettings->all();
In addition, settings can now be accessed in TypoScript via getData
with the key siteSettings
:
page.10 = TEXT
page.10.data = siteSettings:redirects.httpStatusCode