[DOCS] Fix PHP code example in changelog
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / 10.2 / Deprecation-89718-LegacyPageTSconfigParsingLowlevelAPI.rst
1 .. include:: ../../Includes.txt
2
3 ==============================================================
4 Deprecation: #89718 - Legacy PageTSconfig parsing lowlevel API
5 ==============================================================
6
7 See :issue:`89718`
8
9 Description
10 ===========
11
12 Two new PHP API classes for retrieving and parsing TsConfig are
13 introduced:
14
15 - :php:`TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader`
16 - :php:`TYPO3\CMS\Core\Configuration\Parser\PageTsConfigParser`
17
18 As this API is more consistent, and flexible, as well as agnostic
19 of the current Context of backend or frontend, the following
20 functionality has been marked as deprecated:
21
22 - :php:`TYPO3\CMS\Core\Configuration\TsConfigParser`
23 - :php:`TYPO3\CMS\Backend\Utility\BackendUtility::getRawPagesTSconfig()`
24
25
26 Impact
27 ======
28
29 Instantiating the PHP class or the mentioned PHP method will trigger
30 a deprecation message.
31
32
33 Affected Installations
34 ======================
35
36 TYPO3 Installations with extensions using the lowlevel API for handling PageTSconfig.
37
38
39 Migration
40 =========
41
42 Loading and parsing PageTSconfig on a low-level should be done via the new PHP classes:
43
44 - :php:`TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader`
45 - :php:`TYPO3\CMS\Core\Configuration\Parser\PageTsConfigParser`
46
47 Usages for fetching all available PageTS of a page/rootline in one large string:
48
49 .. code-block:: php
50
51 $loader = GeneralUtility::makeInstance(PageTsConfigLoader::class);
52 $tsConfigString = $loader->load($rootLine);
53
54
55 The string is parsed (and conditions are applied) with the Parser:
56
57 .. code-block:: php
58
59 $parser = GeneralUtility::makeInstance(
60 PageTsConfigParser::class,
61 $typoScriptParser,
62 $hashCache
63 );
64 $pagesTSconfig = $parser->parse(
65 $tsConfigString,
66 $conditionMatcher
67 );
68
69 Extension developers should rely on this syntax rather than
70 on :php:`$GLOBALS['TSFE']->getPagesTSconfig()` or :php:`BackendUtility::getPagesTsConfig()`, or the deprecated method / class.
71
72 .. index:: PHP-API, TSConfig, FullyScanned, ext:core