[BUGFIX] Cannot load css_styled_content TS using INCLUDE_TYPOSCRIPT 79/21679/8
authorIngo Renner <ingo@typo3.org>
Thu, 27 Jun 2013 01:53:35 +0000 (18:53 -0700)
committerIngo Renner <ingo@typo3.org>
Tue, 9 Jul 2013 20:09:39 +0000 (22:09 +0200)
When installing extensions they may register plugins in ext_localconf.php.
By doing so some default TypoScript is generated in
Extensionutility::configurePlugin() that is then added using
ExtensionManagementUtility::addTypoScript().

Parts of the generated TypoScript are stored in
$TYPO3_CONF_VARS['FE']['contentRenderingTemplates']* and are loaded later
during TypoScript parsing after including the content rendering template.

These TS parts are used to resolve which classes and methods to call when
a plugin needs to be rendered on a page. You can find them in
tt_content.list.20.*

"content default" used to be the old content rendering template with uid
43, today we use css_styled_content instead. The part in the TypoScript
processing chain to load these generated snippets -
TemplateService::includeStaticTypoScriptSources() - is only executed when
loading the content rendering templates using the "Include static (from
extensions)" field in template records.

In return this means if you try to move as much TS to files as possible
you will still have to include css_styled_content through the Template
records in the backend. In other words when actually trying to include
css_styled_content TS from a file, the generated snippets for
tt_content.list.20.* will not be loaded and thus no plugin can be
executed.

Resolves: #49461
Resolves: #44983
Releases: 6.2, 6.1, 6.0
Change-Id: I77c0d64759fa0b5b27cac0ae1acd55e9abefe7f8
Reviewed-on: https://review.typo3.org/21679
Reviewed-by: Markus Klein
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Ingo Renner
Tested-by: Ingo Renner
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php

index 5ad49b8..132f7ba 100644 (file)
@@ -749,6 +749,28 @@ class TypoScriptParser {
                                                                                                        $included_text = $included_text['typoscript'];
                                                                                                }
                                                                                                $newString .= $included_text . LF;
+
+                                                                                               // load default TypoScript for content rendering templates like
+                                                                                               // css_styled_content if those have been included through f.e.
+                                                                                               // <INCLUDE_TYPOSCRIPT: source="FILE:EXT:css_styled_content/static/setup.txt">
+                                                                                               $filePointer = strtolower(trim($sourceParts[1]));
+                                                                                               if (GeneralUtility::isFirstPartOfStr($filePointer, 'ext:')) {
+                                                                                                       $filePointerPathParts = explode('/', substr($filePointer, 4));
+
+                                                                                                       // remove file part, determine whether to load setup or constants
+                                                                                                       list($includeType, ) = explode('.', array_pop($filePointerPathParts));
+
+                                                                                                       if (in_array($includeType, array('setup', 'constants'))) {
+                                                                                                               // adapt extension key to required format (no underscores)
+                                                                                                               $filePointerPathParts[0] = str_replace('_', '', $filePointerPathParts[0]);
+
+                                                                                                               // load default TypoScript
+                                                                                                               $defaultTypoScriptKey = implode('/', $filePointerPathParts) . '/';
+                                                                                                               if (isset($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $includeType . '.'][$defaultTypoScriptKey])) {
+                                                                                                                       $newString .= $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $includeType . '.'][$defaultTypoScriptKey];
+                                                                                                               }
+                                                                                                       }
+                                                                                               }
                                                                                        } else {
                                                                                                $newString .= '
 ###