Deprecation: #99120 - Deprecate old TypoScriptParser¶
See forge#99120
Description¶
To phase out usages of the old TypoScript parser by switching to the new parser approach, a couple of classes and methods have been marked as deprecated in TYPO3 v12 that will be removed with v13:
Class
\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
Class
\TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader
Class
\TYPO3\CMS\Core\Configuration\PageTsConfig
Class
\TYPO3\CMS\Core\Configuration\Parser\PageTsConfigParser
Event
\TYPO3\CMS\Core\Configuration\Event\ModifyLoadedPageTsConfigEvent
Method
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getPagesTSconfig()
The existing main API to retrieve PageTsConfig using \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig()
and UserTsConfig using $backendUser->getTSConfig()
is kept.
Impact¶
Using one of the above classes will raise a deprecation level log entry and will stop working with TYPO3 v13.
Affected installations¶
Instances with extensions that use one of the above classes are affected. The extension scanner will find usages with a mixture of weak and strong matches depending on the usage.
Most deprecations are rather "internal" since extensions most likely use the
existing outer API already. Some may be affected when using the
\TYPO3\CMS\Core\Configuration\Event\ModifyLoadedPageTsConfigEvent
event
or the frontend related method TypoScriptFrontendController->getPagesTSconfig()
,
though.
Migration¶
\TYPO3\CMS\Core\Configuration\Event\ModifyLoadedPageTsConfigEvent
¶
This event is consumed by some extensions to modify calculated PageTsConfig strings
before parsing. The event moved its namespace from
\TYPO3\CMS\Core\Configuration\Event\ModifyLoadedPageTsConfigEvent
to
\TYPO3\CMS\Core\TypoScript\IncludeTree\Event\ModifyLoadedPageTsConfigEvent
in
TYPO3 v12, but is kept as-is apart from that. The TYPO3 v12 core triggers both the old
and the new event, and TYPO3 v13 will stop calling the old event.
Extension that want to stay compatible with both TYPO3 v11 and v12 should continue to implement listen for the old event only. This will not raise a deprecation level log entry in v12, but it will stop working with TYPO3 v13. Extensions with compatibility for TYPO3 12 and above should switch to the new event.
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getPagesTSconfig()
¶
The TYPO3 Frontend should usually not need to retrieve Backend related PageTsConfig.
Extensions using the method should avoid relying on bringing Backend related configuration
into Frontend scope. However, the TYPO3 core comes with one place that does this: Class
TYPO3\CMS\Frontend\Typolink\DatabaseRecordLinkBuilder
uses PageTsConfig related
information in Frontend scope. Extensions with similar use cases could have a similar
implementation as done with DatabaseRecordLinkBuilder->getPageTsConfig()
. Note
any implementation of this will have to rely on @internal
usages of the new
TypoScript parser approach, and using this low level API may thus break without
further notice. Extensions are encouraged to cover usages with functional tests to find
issues quickly in case the TYPO3 core still changes used classes.
\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
¶
In general, extensions probably don't need to use the old TypoScriptParser
often: Frontend TypoScript is available as request attribute,
pageTsConfig should be retrieved using BackendUtility::getPagesTSconfig()
and
userTsConfig should be retrieved using $backendUser->getTSConfig()
.
In case extensions want to parse any other strings that follow a TypoScript-a-like syntax,
they can use \TYPO3\CMS\Core\TypoScript\TypoScriptStringFactory
, or could set up
their own factory using the new parser classes for more complex scenarios. Note the new parser
approach is still marked @internal
, using this low level API may thus break without
further notice. Extensions are encouraged to cover usages with functional tests to find
issues quickly in case the TYPO3 core still changes used classes.
\TYPO3\CMS\Core\Configuration\PageTsConfig
¶
There is little need to use \TYPO3\CMS\Core\Configuration\PageTsConfig
and their helper
classes \TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader
and
\TYPO3\CMS\Core\Configuration\Parser\PageTsConfigParser
directly: The main API
in Backend context is \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig()
.
See the hint on \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getPagesTSconfig()
above for notes on how to migrate usages in Frontend context.