2 namespace TYPO3\CMS\T3editor;
35 $GLOBALS[
'LANG']->includeLLFile(
'EXT:t3editor/Resources/Private/Language/locallang.xlf');
49 return $this->loadTemplates($pageId);
59 protected function loadTemplates($pageId)
65 if (
$GLOBALS[
'BE_USER']->isAdmin()) {
68 $response->getBody()->write(json_encode($this->getMergedTemplates($pageId)));
88 protected function getMergedTemplates($pageId, $templateId = 0)
92 $tsParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
93 $tsParser->tt_track = 0;
96 $page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
97 $rootLine = $page->getRootLine($pageId);
99 $tsParser->runThroughTemplates($rootLine);
102 array_pop($tsParser->config);
103 array_pop($tsParser->constants);
104 $tsParser->linkObjects =
true;
105 $tsParser->ext_regLinenumbers =
false;
106 $tsParser->bType = $bType;
107 $tsParser->generateConfig();
121 $cleanedTreeBranch = array();
122 foreach ($treeBranch as $key => $value) {
123 $dotCount = substr_count($key,
'.');
125 if ($dotCount == 0) {
127 if (strlen($value) > 20) {
128 $value = substr($value, 0, 20);
130 if (!isset($cleanedTreeBranch[$key])) {
131 $cleanedTreeBranch[$key] = array();
133 $cleanedTreeBranch[$key][
'v'] = $value;
135 }
elseif ($dotCount == 1) {
139 $key = str_replace(
'.',
'', $key);
140 if (!isset($cleanedTreeBranch[$key])) {
141 $cleanedTreeBranch[$key] = array();
143 $cleanedTreeBranch[$key][
'c'] = $subBranch;
147 return $cleanedTreeBranch;