‪TYPO3CMS  9.5
TYPO3\CMS\Core\TypoScript\TemplateService Class Reference
Inheritance diagram for TYPO3\CMS\Core\TypoScript\TemplateService:
TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait TYPO3\CMS\Core\TypoScript\ExtendedTemplateService TYPO3\CMS\Core\TypoScript\ConfigurationForm

Public Member Functions

 __construct (Context $context=null, PackageManager $packageManager=null)
 
bool getProcessExtensionStatics ()
 
 setProcessExtensionStatics ($processExtensionStatics)
 
 setVerbose ($verbose)
 
 init ()
 
array getCurrentPageData ()
 
array matching ($cc)
 
 start ($theRootLine)
 
 runThroughTemplates ($theRootLine, $start_template_uid=0)
 
 processTemplate ($row, $idList, $pid, $templateID='', $templateParent='', $includePath='')
 
 updateRootlineData ($fullRootLine)
 
 includeStaticTypoScriptSources ($idList, $templateID, $pid, $row)
 
 addExtensionStatics ($idList, $templateID, $pid)
 
 generateConfig ()
 
string substituteConstantsCallBack ($matches)
 
string null getFileName ($fileFromSetup)
 
string printTitle ($pageTitle, $noTitle=false, $showTitleFirst=false, $pageTitleSeparator='')
 
int getRootlineLevel ($list)
 
int getRootId ()
 
array linkData ($page, $oTarget, $no_cache, $_=null, $overrideArray=null, $addParams='', $typeOverride='', $targetDomain='')
 
string getFromMPmap ($pageId=0)
 
 initMPmap_create ($id, $MP_array=[], $level=0)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait
bool __isset (string $propertyName)
 
mixed __get (string $propertyName)
 
 __set (string $propertyName, $propertyValue)
 
 __unset (string $propertyName)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait
mixed __call (string $methodName, array $arguments)
 

Public Attributes

bool $tt_track = true
 
bool $forceTemplateParsing = false
 
array $matchAlternative = array( )
 
int $ext_constants_BRP = 0
 
int $ext_config_BRP = 0
 
bool $ext_regLinenumbers = false
 
bool $ext_regComments = false
 
bool $loaded = false
 
array $setup = array( )
 
array $flatSetup = array( )
 
array $config = array( )
 
array $constants = array( )
 
array $hierarchyInfo = array( )
 
array $rootLine
 
array null $sections
 
 $clearList_const = array( )
 
array $clearList_setup = array( )
 
array $parserErrors = array( )
 
array $setup_constants = array( )
 

Protected Member Functions

 initializeDatabaseQueryRestrictions ()
 
string getTypoScriptSourceFileContent ($filePath, $baseName)
 
array prependStaticExtra ($subrow)
 
 versionOL (&$row)
 
 processIncludes ()
 
array mergeConstantsFromPageTSconfig ($constArray)
 
array mergeConstantsFromIncludedTsConfigFiles ($filesToInclude, $TSdataArray)
 
 flattenSetup ($setupArray, $prefix)
 
string substituteConstants ($all)
 
 addDefaultTypoScript ()
 
TypoScriptFrontendController getTypoScriptFrontendController ()
 
TimeTracker getTimeTracker ()
 
mixed getCacheEntry ($identifier)
 
 setCacheEntry ($identifier, $data, $tag)
 

Protected Attributes

array $deprecatedPublicProperties
 
array $deprecatedPublicMethods
 
bool $verbose = false
 
bool $matchAll = false
 
string $whereClause = ''
 
bool $debug = false
 
array $allowedPaths = array( )
 
int $simulationHiddenOrTime = 0
 
array $templateIncludePaths = array( )
 
array $hierarchyInfoToRoot = array( )
 
int $nextLevel = 0
 
int $rootId
 
array $absoluteRootLine
 
int $outermostRootlineIndexWithTemplate = 0
 
array $rowSum
 
string $sitetitle = ''
 
array $sectionsMatch
 
array $fileCache = array( )
 
array $frames = array( )
 
string $MPmap = ''
 
bool $extensionStaticsProcessed = false
 
bool $processExtensionStatics = false
 
bool $isDefaultTypoScriptAdded = false
 
bool $processIncludesHasBeenRun = false
 
AbstractRestrictionContainer $queryBuilderRestrictions
 
Context $context
 
PackageManager $packageManager
 

Detailed Description

Template object that is responsible for generating the TypoScript template based on template records.

See also
‪\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
‪\TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher

Definition at line 49 of file TemplateService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\TypoScript\TemplateService::__construct ( Context  $context = null,
PackageManager  $packageManager = null 
)

Member Function Documentation

◆ addDefaultTypoScript()

TYPO3\CMS\Core\TypoScript\TemplateService::addDefaultTypoScript ( )
protected

Adds the TypoScript from the global array. The class property isDefaultTypoScriptAdded ensures that the adding only happens once.

See also
‪isDefaultTypoScriptAdded

Definition at line 1708 of file TemplateService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), and TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ addExtensionStatics()

TYPO3\CMS\Core\TypoScript\TemplateService::addExtensionStatics (   $idList,
  $templateID,
  $pid 
)

Adds the default TypoScript files for extensions if any.

Parameters
string$idList‪A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
string$templateID‪The id of the current template. Same syntax as $idList ids, eg. "sys_123
int$pid‪The PID of the input template record
See also
includeStaticTypoScriptSources()

Definition at line 987 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$config, TYPO3\CMS\Core\TypoScript\TemplateService\$constants, TYPO3\CMS\Core\TypoScript\TemplateService\prependStaticExtra(), and TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), and TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ flattenSetup()

TYPO3\CMS\Core\TypoScript\TemplateService::flattenSetup (   $setupArray,
  $prefix 
)
protected

This flattens a hierarchical TypoScript array to $this->flatSetup

Parameters
array$setupArrayTypoScript array
string$prefix‪Prefix to the object path. Used for recursive calls to this function.
See also
generateConfig()

Definition at line 1326 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_setValueArray(), TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), and TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\generateConfig_constants().

◆ generateConfig()

◆ getCacheEntry()

mixed TYPO3\CMS\Core\TypoScript\TemplateService::getCacheEntry (   $identifier)
protected

Returns data stored for the hash string in the cache "cache_hash" used to store the parsed TypoScript template structures.

Parameters
string$identifier‪The hash-string which was used to store the data value
Returns
‪mixed The data from the cache

Definition at line 1763 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ getCurrentPageData()

array TYPO3\CMS\Core\TypoScript\TemplateService::getCurrentPageData ( )

Fetches the "currentPageData" array from cache

NOTE about currentPageData: It holds information about the TypoScript conditions along with the list of template uid's which is used on the page. In the getFromCache() function in TSFE, currentPageData is used to evaluate if there is a template and if the matching conditions are alright. Unfortunately this does not take into account if the templates in the rowSum of currentPageData has changed composition, eg. due to hidden fields or start/end time. So if a template is hidden or times out, it'll not be discovered unless the page is regenerated - at least the this->start function must be called, because this will make a new portion of data in currentPageData string.

Returns
‪array Returns the unmatched array $currentPageData if found cached in "cache_pagesection". Otherwise FALSE is returned which means that the array must be generated and stored in the cache

Definition at line 478 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController().

◆ getFileName()

string null TYPO3\CMS\Core\TypoScript\TemplateService::getFileName (   $fileFromSetup)

Returns the reference used for the frontend inclusion, checks against allowed paths for inclusion.

Parameters
string$fileFromSetupTypoScript "resource" data type value.
Returns
‪string|null Resulting filename, is either a full absolute URL or a relative path. Returns NULL if invalid filename or a directory is given
Deprecated:
‪since TYPO3 v9.4, will be removed in TYPO3 v10.0.

Definition at line 1390 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\getTimeTracker(), and TYPO3\CMS\Core\TimeTracker\TimeTracker\setTSlogMessage().

◆ getFromMPmap()

string TYPO3\CMS\Core\TypoScript\TemplateService::getFromMPmap (   $pageId = 0)

Initializes the automatically created MPmap coming from the "config.MP_mapRootPoints" setting Can be called many times with overhead only the first time since then the map is generated and cached in memory.

Parameters
int$pageIdPage id to return MPvar value for.
Returns
‪string
See also
initMPmap_create()
Todo:
‪Implement some caching of the result between hits. (more than just the memory caching used here)
Deprecated:
  • ‪will be removed in TYPO3 v10.0.

Definition at line 1586 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController(), and TYPO3\CMS\Core\TypoScript\TemplateService\initMPmap_create().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\linkData().

◆ getProcessExtensionStatics()

bool TYPO3\CMS\Core\TypoScript\TemplateService::getProcessExtensionStatics ( )
Returns
‪bool

Definition at line 384 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$processExtensionStatics.

◆ getRootId()

int TYPO3\CMS\Core\TypoScript\TemplateService::getRootId ( )

Returns the page ID of the rootlevel

Returns
‪int

Definition at line 1472 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$rootId.

◆ getRootlineLevel()

int TYPO3\CMS\Core\TypoScript\TemplateService::getRootlineLevel (   $list)

Returns the level of the given page in the rootline - Multiple pages can be given by separating the UIDs by comma.

Parameters
string$list‪A list of UIDs for which the rootline-level should get returned
Returns
‪int The level in the rootline. If more than one page was given the lowest level will get returned.

Definition at line 1455 of file TemplateService.php.

◆ getTimeTracker()

◆ getTypoScriptFrontendController()

◆ getTypoScriptSourceFileContent()

string TYPO3\CMS\Core\TypoScript\TemplateService::getTypoScriptSourceFileContent (   $filePath,
  $baseName 
)
protected

Retrieves the content of the first existing file by extension order. Returns the empty string if no file is found.

Parameters
string$filePath‪The location of the file.
string$baseName‪The base file name. "constants" or "setup".
Returns
‪string

Definition at line 966 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources().

◆ includeStaticTypoScriptSources()

TYPO3\CMS\Core\TypoScript\TemplateService::includeStaticTypoScriptSources (   $idList,
  $templateID,
  $pid,
  $row 
)

Includes static template files (from extensions) for the input template record row.

Parameters
string$idList‪A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
string$templateID‪The id of the current template. Same syntax as $idList ids, eg. "sys_123
int$pid‪The PID of the input template record
array$row‪A full TypoScript template record
See also
processTemplate()

Definition at line 897 of file TemplateService.php.

References $GLOBALS, TYPO3\CMS\Core\TypoScript\TemplateService\addExtensionStatics(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptSourceFileContent(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded(), TYPO3\CMS\Core\TypoScript\TemplateService\prependStaticExtra(), and TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate().

◆ init()

TYPO3\CMS\Core\TypoScript\TemplateService::init ( )

Initialize

Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0

Definition at line 411 of file TemplateService.php.

References $GLOBALS, and TYPO3\CMS\Core\TypoScript\TemplateService\initializeDatabaseQueryRestrictions().

◆ initializeDatabaseQueryRestrictions()

TYPO3\CMS\Core\TypoScript\TemplateService::initializeDatabaseQueryRestrictions ( )
protected

$this->whereclause is kept for backwards compatibility

Definition at line 442 of file TemplateService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\__construct(), and TYPO3\CMS\Core\TypoScript\TemplateService\init().

◆ initMPmap_create()

TYPO3\CMS\Core\TypoScript\TemplateService::initMPmap_create (   $id,
  $MP_array = [],
  $level = 0 
)

Creating MPmap for a certain ID root point.

Parameters
int$id‪Root id from which to start map creation.
array$MP_array‪MP_array passed from root page.
int$level‪Recursion brake. Incremented for each recursive call. 20 is the limit.
See also
‪getFromMPvar()
Deprecated:
‪will be removed in TYPO3 v10.0

Definition at line 1623 of file TemplateService.php.

References TYPO3\CMS\Frontend\Page\PageRepository\DOKTYPE_BE_USER_SECTION, TYPO3\CMS\Frontend\Page\PageRepository\DOKTYPE_RECYCLER, and TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\getFromMPmap().

◆ linkData()

array TYPO3\CMS\Core\TypoScript\TemplateService::linkData (   $page,
  $oTarget,
  $no_cache,
  $_ = null,
  $overrideArray = null,
  $addParams = '',
  $typeOverride = '',
  $targetDomain = '' 
)

The mother of all functions creating links/URLs etc in a TypoScript environment. See the references below. Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc. It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this.

Parameters
array$page‪The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, title and sectionIndex_uid.
string$oTarget‪Default target string to use IF not $page['target'] is set.
bool$no_cache‪If set, then the "&no_cache=1" parameter is included in the URL.
string$_‪not in use anymore
array$overrideArray‪Array with overriding values for the $page array.
string$addParams‪Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed.
string$typeOverride‪If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $this->getTypoScriptFrontendController()->config['config']['forceTypeValue'] if found.
string$targetDomain‪The target Doamin, if any was detected in typolink
Returns
‪array Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL
See also
‪\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::typoLink(), \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::link()
Deprecated:
  • ‪will be removed in TYPO3 v10.0 - have a look at PageLinkBuilder

Definition at line 1500 of file TemplateService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString(), TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Core\TypoScript\TemplateService\getFromMPmap(), and TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController().

◆ matching()

array TYPO3\CMS\Core\TypoScript\TemplateService::matching (   $cc)

Fetches data about which TypoScript-matches there are at this page. Then it performs a matchingtest.

Parameters
array$cc‪An array with three keys, "all", "rowSum" and "rootLine" - all coming from the "currentPageData" array
Returns
‪array The input array but with a new key added, "match" which contains the items from the "all" key which when passed to tslib_matchCondition returned TRUE.

Definition at line 489 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$sectionsMatch.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ mergeConstantsFromIncludedTsConfigFiles()

array TYPO3\CMS\Core\TypoScript\TemplateService::mergeConstantsFromIncludedTsConfigFiles (   $filesToInclude,
  $TSdataArray 
)
protected

Reads TSconfig defined in external files and appends it to the given TSconfig array (in this case only constants)

Parameters
array$filesToInclude‪The files to read constants from
array$TSdataArray‪The TSconfig array the constants should be appended to
Returns
‪array The TSconfig with the included constants appended

Definition at line 1294 of file TemplateService.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\mergeConstantsFromPageTSconfig().

◆ mergeConstantsFromPageTSconfig()

array TYPO3\CMS\Core\TypoScript\TemplateService::mergeConstantsFromPageTSconfig (   $constArray)
protected

Loads Page TSconfig until the outermost template record and parses the configuration - if TSFE.constants object path is found it is merged with the default data in here!

Parameters
array$constArray‪Constants array, default input.
Returns
‪array Constants array, modified
Todo:
‪Apply caching to the parsed Page TSconfig. This is done in the other similar functions for both frontend and backend. However, since this functions works for BOTH frontend and backend we will have to either write our own local caching function or (more likely) detect if we are in FE or BE and use caching functions accordingly. Not having caching affects mostly the backend modules inside the "Template" module since the overhead in the frontend is only seen when TypoScript templates are parsed anyways (after which point they are cached anyways...)

Definition at line 1257 of file TemplateService.php.

References $GLOBALS, TYPO3\CMS\Core\TypoScript\TemplateService\$outermostRootlineIndexWithTemplate, TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\checkIncludeLines_array(), TYPO3\CMS\Core\TypoScript\TemplateService\mergeConstantsFromIncludedTsConfigFiles(), and TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), and TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\generateConfig_constants().

◆ prependStaticExtra()

array TYPO3\CMS\Core\TypoScript\TemplateService::prependStaticExtra (   $subrow)
protected

Appends (not prepends) additional TypoScript code to static template records/files as set in TYPO3_CONF_VARS For files the "uid" value is the extension key but with any underscores removed. Possibly with a path if its a static file selected in the template record

Parameters
array$subrow‪Static template record/file
Returns
‪array Returns the input array where the values for keys "config" and "constants" may have been modified with prepended code.
See also
addExtensionStatics(), includeStaticTypoScriptSources()

Definition at line 1054 of file TemplateService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\addExtensionStatics(), and TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources().

◆ printTitle()

string TYPO3\CMS\Core\TypoScript\TemplateService::printTitle (   $pageTitle,
  $noTitle = false,
  $showTitleFirst = false,
  $pageTitleSeparator = '' 
)

Compiles the content for the page <title> tag.

Parameters
string$pageTitle‪The input title string, typically the "title" field of a page's record.
bool$noTitle‪If set, then only the site title is outputted (from $this->setup['sitetitle'])
bool$showTitleFirst‪If set, then "sitetitle" and $title is swapped
string$pageTitleSeparator‪an alternative to the ": " as the separator between site title and page title
Returns
‪string The page title on the form "[sitetitle]: [input-title]". Not htmlspecialchar()'ed.
See also
‪\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::tempPageCacheContent(), \TYPO3\CMS\Frontend\Page\PageGenerator::renderContentWithHeader()
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0, use $TSFE->generatePageTitle() instead.

Definition at line 1429 of file TemplateService.php.

◆ processIncludes()

TYPO3\CMS\Core\TypoScript\TemplateService::processIncludes ( )
protected

Searching TypoScript code text (for constants and config (Setup)) for include instructions and does the inclusion of external TypoScript files if needed.

See also
‪\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser, generateConfig()

Definition at line 1218 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$templateIncludePaths, and TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\checkIncludeLines().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), and TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ processTemplate()

TYPO3\CMS\Core\TypoScript\TemplateService::processTemplate (   $row,
  $idList,
  $pid,
  $templateID = '',
  $templateParent = '',
  $includePath = '' 
)

Checks if the template ($row) has some included templates and after including them it fills the arrays with the setup Builds up $this->rowSum

Parameters
array$row‪A full TypoScript template record (sys_template/forged "dummy" record made from static template file)
string$idList‪A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
int$pid‪The PID of the input template record
string$templateID‪The id of the current template. Same syntax as $idList ids, eg. "sys_123 @param string $templateParent Parent template id (during recursive call); Same syntax as $idList ids, eg. "sys_123
string$includePath‪Specifies the path from which the template was included (used with static_includes)
See also
runThroughTemplates()

Definition at line 743 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), and TYPO3\CMS\Core\TypoScript\TemplateService\versionOL().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\addExtensionStatics(), TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), and TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ runThroughTemplates()

TYPO3\CMS\Core\TypoScript\TemplateService::runThroughTemplates (   $theRootLine,
  $start_template_uid = 0 
)

Traverses the rootLine from the root and out. For each page it checks if there is a template record. If there is a template record, $this->processTemplate() is called. Resets and affects internal variables like $this->constants, $this->config and $this->rowSum Also creates $this->rootLine which is a root line stopping at the root template (contrary to $this->getTypoScriptFrontendController()->rootLine which goes all the way to the root of the tree

Parameters
array$theRootLine‪The rootline of the current page (going ALL the way to tree root)
int$start_template_uid‪Set specific template record UID to select; this is only for debugging/development/analysis use in backend modules like "Web > Template". For parsing TypoScript templates in the frontend it should be 0 (zero)
See also
start()

Definition at line 640 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$absoluteRootLine, TYPO3\CMS\Core\TypoScript\TemplateService\$extensionStaticsProcessed, $GLOBALS, TYPO3\CMS\Core\TypoScript\TemplateService\$isDefaultTypoScriptAdded, TYPO3\CMS\Core\TypoScript\TemplateService\$rootLine, TYPO3\CMS\Core\TypoScript\TemplateService\addDefaultTypoScript(), TYPO3\CMS\Core\TypoScript\TemplateService\addExtensionStatics(), TYPO3\CMS\Core\TypoScript\TemplateService\processIncludes(), TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate(), and TYPO3\CMS\Core\TypoScript\TemplateService\versionOL().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ setCacheEntry()

TYPO3\CMS\Core\TypoScript\TemplateService::setCacheEntry (   $identifier,
  $data,
  $tag 
)
protected

Stores $data in the 'cache_hash' cache with the hash key $identifier

Parameters
string$identifier‪32 bit hash string (eg. a md5 hash of a serialized array identifying the data being stored)
mixed$data‪The data to store
string$tag‪Is just a textual identification in order to inform about the content

Definition at line 1775 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ setProcessExtensionStatics()

TYPO3\CMS\Core\TypoScript\TemplateService::setProcessExtensionStatics (   $processExtensionStatics)
Parameters
bool$processExtensionStatics

Definition at line 392 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$processExtensionStatics.

◆ setVerbose()

TYPO3\CMS\Core\TypoScript\TemplateService::setVerbose (   $verbose)

sets the verbose parameter

Parameters
bool$verbose

Definition at line 401 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$verbose.

◆ start()

TYPO3\CMS\Core\TypoScript\TemplateService::start (   $theRootLine)

This is all about fetching the right TypoScript template structure. If it's not cached then it must be generated and cached! The method traverses the rootline structure from out to in, fetches the hierarchy of template records and based on this either finds the cached TypoScript template structure or parses the template and caches it for next time. Sets $this->setup to the parsed TypoScript template array

Parameters
array$theRootLine‪The rootline of the current page (going ALL the way to tree root)
See also
‪\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getConfigArray()

Definition at line 514 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\$rootLine, TYPO3\CMS\Core\TypoScript\TemplateService\$rowSum, TYPO3\CMS\Core\TypoScript\TemplateService\$sections, TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), TYPO3\CMS\Core\TypoScript\TemplateService\getCacheEntry(), TYPO3\CMS\Core\TypoScript\TemplateService\getTimeTracker(), TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController(), TYPO3\CMS\Core\TypoScript\TemplateService\matching(), TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates(), TYPO3\CMS\Core\TypoScript\TemplateService\setCacheEntry(), and TYPO3\CMS\Core\TimeTracker\TimeTracker\setTSlogMessage().

◆ substituteConstants()

string TYPO3\CMS\Core\TypoScript\TemplateService::substituteConstants (   $all)
protected

Substitutes the constants from $this->flatSetup in the text string $all

Parameters
string$allTypoScript code text string
Returns
‪string The processed string with all constants found in $this->flatSetup as key/value pairs substituted.
See also
generateConfig(), flattenSetup()

Reimplemented in TYPO3\CMS\Core\TypoScript\ExtendedTemplateService.

Definition at line 1346 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\getTimeTracker(), and TYPO3\CMS\Core\TimeTracker\TimeTracker\setTSlogMessage().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig().

◆ substituteConstantsCallBack()

string TYPO3\CMS\Core\TypoScript\TemplateService::substituteConstantsCallBack (   $matches)

Call back method for preg_replace_callback in substituteConstants

Parameters
array$matches‪Regular expression matches
Returns
‪string Replacement
See also
substituteConstants()

Reimplemented in TYPO3\CMS\Core\TypoScript\ExtendedTemplateService.

Definition at line 1371 of file TemplateService.php.

◆ updateRootlineData()

TYPO3\CMS\Core\TypoScript\TemplateService::updateRootlineData (   $fullRootLine)

This function can be used to update the data of the current rootLine e.g. when a different language is used.

This function must not be used if there are different pages in the rootline as before!

Parameters
array$fullRootLine‪Array containing the FULL rootline (up to the TYPO3 root)
Exceptions

Definition at line 865 of file TemplateService.php.

◆ versionOL()

TYPO3\CMS\Core\TypoScript\TemplateService::versionOL ( $row)
protected

Creating versioning overlay of a sys_template record. This will use either frontend or backend overlay functionality depending on environment.

Parameters
array$row‪Row to overlay (passed by reference)

Definition at line 1074 of file TemplateService.php.

References TYPO3\CMS\Core\TypoScript\TemplateService\getTypoScriptFrontendController(), and TYPO3\CMS\Backend\Utility\BackendUtility\workspaceOL().

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate(), and TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

Member Data Documentation

◆ $absoluteRootLine

array TYPO3\CMS\Core\TypoScript\TemplateService::$absoluteRootLine
protected

Rootline all the way to the root. Set but runThroughTemplates

Definition at line 229 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ $allowedPaths

array TYPO3\CMS\Core\TypoScript\TemplateService::$allowedPaths = array( )
protected

This is the only paths (relative!!) that are allowed for resources in TypoScript. Should all be appended with '/'. You can extend these by the global array TYPO3_CONF_VARS. See init() function.

Definition at line 153 of file TemplateService.php.

◆ $clearList_const

TYPO3\CMS\Core\TypoScript\TemplateService::$clearList_const = array( )

Used by Backend only (Typoscript Template Analyzer)

Definition at line 264 of file TemplateService.php.

◆ $clearList_setup

array TYPO3\CMS\Core\TypoScript\TemplateService::$clearList_setup = array( )

Used by Backend only (Typoscript Template Analyzer)

Definition at line 270 of file TemplateService.php.

◆ $config

array TYPO3\CMS\Core\TypoScript\TemplateService::$config = array( )

For fetching TypoScript code from template hierarchy before parsing it. Each array contains code field values from template records/files: Setup field

Definition at line 181 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\addExtensionStatics(), TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_outputTS(), and TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig().

◆ $constants

◆ $context

◆ $debug

bool TYPO3\CMS\Core\TypoScript\TemplateService::$debug = false
protected

Definition at line 146 of file TemplateService.php.

◆ $deprecatedPublicMethods

array TYPO3\CMS\Core\TypoScript\TemplateService::$deprecatedPublicMethods
protected
Initial value:
= array(
'prependStaticExtra' => 'Using prependStaticExtra() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
'versionOL' => 'Using versionOL() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
'processIncludes' => 'Using processIncludes() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
'mergeConstantsFromPageTSconfig' => 'Using mergeConstantsFromPageTSconfig() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
'flattenSetup' => 'Using flattenSetup() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
'substituteConstants' => 'Using substituteConstants() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
)

Methods which have been moved to protected status from public

Definition at line 76 of file TemplateService.php.

◆ $deprecatedPublicProperties

array TYPO3\CMS\Core\TypoScript\TemplateService::$deprecatedPublicProperties
protected
Initial value:
= array(
'matchAll' => 'Using $matchAll of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'whereClause' => 'Using $whereClause of class TemplateService is discouraged, as this has been superseded by Doctrine DBAL API.',
'debug' => 'Using $debug of class TemplateService is discouraged, as this option has no effect anymore.',
'allowedPaths' => 'Using $allowedPaths of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'simulationHiddenOrTime' => 'Using $simulationHiddenOrTime of class TemplateService is discouraged, as this has been superseeded by Doctrine DBAL API.',
'nextLevel' => 'Using $nextLevel of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'rootId' => 'Using $rootId of class TemplateService from the outside is discouraged, use TemplateService->getRootId() instead.',
'absoluteRootLine' => 'Using $absoluteRootLine of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'outermostRootlineIndexWithTemplate' => 'Using $outermostRootlineIndexWithTemplate of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'rowSum' => 'Using $rowSum of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'sitetitle' => 'Using $sitetitle of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'sectionsMatch' => 'Using $sectionsMatch of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'frames' => 'Using $frames of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'MPmap' => 'Using $MPmap of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
'fileCache' => 'Using $fileCache of class TemplateService from the outside is discouraged, the property will be removed in TYPO3 v10.0.',
)

Properties which have been moved to protected status from public

Definition at line 55 of file TemplateService.php.

◆ $ext_config_BRP

int TYPO3\CMS\Core\TypoScript\TemplateService::$ext_config_BRP = 0

Definition at line 128 of file TemplateService.php.

◆ $ext_constants_BRP

int TYPO3\CMS\Core\TypoScript\TemplateService::$ext_constants_BRP = 0

Externally set breakpoints (used by Backend Modules)

Definition at line 124 of file TemplateService.php.

◆ $ext_regComments

bool TYPO3\CMS\Core\TypoScript\TemplateService::$ext_regComments = false

◆ $ext_regLinenumbers

bool TYPO3\CMS\Core\TypoScript\TemplateService::$ext_regLinenumbers = false

◆ $extensionStaticsProcessed

bool TYPO3\CMS\Core\TypoScript\TemplateService::$extensionStaticsProcessed = false
protected

Indicator that extension statics are processed.

These files are considered if either a root template has been processed or the $processExtensionStatics property has been set to TRUE.

Definition at line 308 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ $fileCache

array TYPO3\CMS\Core\TypoScript\TemplateService::$fileCache = array( )
protected

Used by getFileName for caching of references to file resources

Deprecated:
‪Will be removed in TYPO3 v10.0

Definition at line 285 of file TemplateService.php.

◆ $flatSetup

array TYPO3\CMS\Core\TypoScript\TemplateService::$flatSetup = array( )

◆ $forceTemplateParsing

bool TYPO3\CMS\Core\TypoScript\TemplateService::$forceTemplateParsing = false

If set, the template is always rendered. Used from Admin Panel.

Definition at line 103 of file TemplateService.php.

◆ $frames

array TYPO3\CMS\Core\TypoScript\TemplateService::$frames = array( )
protected

Keys are frame names and values are type-values, which must be used to refer correctly to the content of the frames.

Definition at line 291 of file TemplateService.php.

◆ $hierarchyInfo

array TYPO3\CMS\Core\TypoScript\TemplateService::$hierarchyInfo = array( )

For Template Analyzer in backend

Definition at line 199 of file TemplateService.php.

◆ $hierarchyInfoToRoot

array TYPO3\CMS\Core\TypoScript\TemplateService::$hierarchyInfoToRoot = array( )
protected

For Template Analyzer in backend (setup content only)

Definition at line 205 of file TemplateService.php.

◆ $isDefaultTypoScriptAdded

bool TYPO3\CMS\Core\TypoScript\TemplateService::$isDefaultTypoScriptAdded = false
protected

Set to TRUE after the default TypoScript was added during parsing. This prevents double inclusion of the same TypoScript code.

See also
addDefaultTypoScript()

Definition at line 322 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\runThroughTemplates().

◆ $loaded

bool TYPO3\CMS\Core\TypoScript\TemplateService::$loaded = false

Set, if the TypoScript template structure is loaded and OK, see ->start()

Definition at line 165 of file TemplateService.php.

◆ $matchAll

bool TYPO3\CMS\Core\TypoScript\TemplateService::$matchAll = false
protected

If set, the match-class matches everything! Used for backend modules only. Never frontend!

Definition at line 118 of file TemplateService.php.

◆ $matchAlternative

array TYPO3\CMS\Core\TypoScript\TemplateService::$matchAlternative = array( )

This array is passed on to matchObj by generateConfig(). If it holds elements, they are used for matching instead. See comment at the match-class. Used for backend modules only. Never frontend!

Definition at line 112 of file TemplateService.php.

◆ $MPmap

string TYPO3\CMS\Core\TypoScript\TemplateService::$MPmap = ''
protected

Contains mapping of Page id numbers to MP variables. This is not used anymore, and will be removed in TYPO3 v10.0.

Definition at line 298 of file TemplateService.php.

◆ $nextLevel

int TYPO3\CMS\Core\TypoScript\TemplateService::$nextLevel = 0
protected

Next-level flag (see runThroughTemplates())

Definition at line 211 of file TemplateService.php.

◆ $outermostRootlineIndexWithTemplate

int TYPO3\CMS\Core\TypoScript\TemplateService::$outermostRootlineIndexWithTemplate = 0
protected

A pointer to the last entry in the rootline where a template was found.

Definition at line 235 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\mergeConstantsFromPageTSconfig().

◆ $packageManager

PackageManager TYPO3\CMS\Core\TypoScript\TemplateService::$packageManager
protected

◆ $parserErrors

array TYPO3\CMS\Core\TypoScript\TemplateService::$parserErrors = array( )

Definition at line 274 of file TemplateService.php.

◆ $processExtensionStatics

bool TYPO3\CMS\Core\TypoScript\TemplateService::$processExtensionStatics = false
protected

Trigger value, to ensure that extension statics are processed.

Definition at line 314 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\getProcessExtensionStatics(), and TYPO3\CMS\Core\TypoScript\TemplateService\setProcessExtensionStatics().

◆ $processIncludesHasBeenRun

bool TYPO3\CMS\Core\TypoScript\TemplateService::$processIncludesHasBeenRun = false
protected

Set to TRUE after $this->config and $this->constants have processed all <INCLUDE_TYPOSCRIPT:> instructions.

This prevents double processing of INCLUDES.

See also
processIncludes()

Definition at line 331 of file TemplateService.php.

◆ $queryBuilderRestrictions

AbstractRestrictionContainer TYPO3\CMS\Core\TypoScript\TemplateService::$queryBuilderRestrictions
protected

Contains the restrictions about deleted, and some frontend related topics

Definition at line 336 of file TemplateService.php.

◆ $rootId

int TYPO3\CMS\Core\TypoScript\TemplateService::$rootId
protected

The Page UID of the root page

Definition at line 217 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\getRootId().

◆ $rootLine

array TYPO3\CMS\Core\TypoScript\TemplateService::$rootLine

◆ $rowSum

array TYPO3\CMS\Core\TypoScript\TemplateService::$rowSum
protected

Array of arrays with title/uid of templates in hierarchy

Definition at line 241 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ $sections

array null TYPO3\CMS\Core\TypoScript\TemplateService::$sections

Tracking all conditions found during parsing of TypoScript. Used for the "all" key in currentPageData

Definition at line 253 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\start().

◆ $sectionsMatch

array TYPO3\CMS\Core\TypoScript\TemplateService::$sectionsMatch
protected

Tracking all matching conditions found

Definition at line 259 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\matching().

◆ $setup

array TYPO3\CMS\Core\TypoScript\TemplateService::$setup = array( )

Contains TypoScript setup part after parsing

Definition at line 169 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig().

◆ $setup_constants

array TYPO3\CMS\Core\TypoScript\TemplateService::$setup_constants = array( )

Definition at line 278 of file TemplateService.php.

◆ $simulationHiddenOrTime

int TYPO3\CMS\Core\TypoScript\TemplateService::$simulationHiddenOrTime = 0
protected

See init(); Set if preview of some kind is enabled.

Definition at line 159 of file TemplateService.php.

◆ $sitetitle

string TYPO3\CMS\Core\TypoScript\TemplateService::$sitetitle = ''
protected

◆ $templateIncludePaths

array TYPO3\CMS\Core\TypoScript\TemplateService::$templateIncludePaths = array( )
protected

Holds the include paths of the templates (empty if from database)

Definition at line 193 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\processIncludes().

◆ $tt_track

bool TYPO3\CMS\Core\TypoScript\TemplateService::$tt_track = true

If set, the global tt-timeobject is used to log the performance.

Definition at line 97 of file TemplateService.php.

◆ $verbose

bool TYPO3\CMS\Core\TypoScript\TemplateService::$verbose = false
protected

option to enable logging, time-tracking (FE-only) usually, this is only done when

  • ‪in FE a BE_USER is logged-in
  • ‪in BE when the BE_USER needs information about the template (TypoScript module)

Definition at line 91 of file TemplateService.php.

Referenced by TYPO3\CMS\Core\TypoScript\TemplateService\setVerbose().

◆ $whereClause

string TYPO3\CMS\Core\TypoScript\TemplateService::$whereClause = ''
protected

This MUST be initialized by the init() function

Definition at line 142 of file TemplateService.php.