PageRenderer implements SingletonInterface
TYPO3 pageRender class This class render the HTML of a webpage, usable for BE and FE
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Constants
- REQUIREJS_SCOPE_CONFIG = 'config'
- REQUIREJS_SCOPE_RESOLVE = 'resolve'
- PART_COMPLETE = 0
- PART_FOOTER = 2
- PART_HEADER = 1
Properties
- $additionalRequireJsConfig : array<string|int, mixed>
- Inline configuration for requireJS from extensions
- $addRequireJs : bool
- if set, the requireJS library is included
- $baseUrl : string
- $baseUrlTag : string
- $bodyContent : string
- $cache : FrontendInterface
- $charSet : string
- Charset for the rendering
- $compressCss : bool
- $compressJavascript : bool
- $compressor : ResourceCompressor
- $concatenateCss : bool
- $concatenateJavascript : bool
- $cssFiles : array<string, array<string|int, mixed>>
- $cssInline : array<string, array<string|int, mixed>>
- $cssLibs : array<string, array<string|int, mixed>>
- $endingSlash : string
- Is empty string for HTML and ' /' for XHTML rendering
- $favIcon : string
- $footerData : array<string|int, mixed>
- $headerData : array<string|int, mixed>
- $headTag : string
- $htmlTag : string
- $iconMimeType : string
- $inlineComments : array<string|int, mixed>
- $inlineCssWrap : array<string|int, mixed>
- $inlineJavascriptWrap : array{0: string, 1: string}
- $inlineLanguageLabelFiles : array<string|int, mixed>
- $inlineLanguageLabels : array<string|int, mixed>
- $inlineSettings : array<string|int, mixed>
- $internalRequireJsPathModuleNames : array<string|int, mixed>
- Module names of internal requireJS 'paths'
- $javaScriptRenderer : JavaScriptRenderer
- $jsFiles : array<string, array<string|int, mixed>>
- $jsFooterFiles : array<string|int, mixed>
- $jsFooterInline : array<string|int, mixed>
- $jsFooterLibs : array<string|int, mixed>
- $jsInline : array<string, array<string|int, mixed>>
- $jsLibs : array<string|int, mixed>
- $lang : string
- The language key Two character string or 'default'
- $languageDependencies : array<string|int, mixed>
- List of language dependencies for actual language. This is used for local variants of a language that depend on their "main" language, like Brazilian Portuguese or Canadian French.
- $locales : Locales
- $metaCharsetTag : string
- $metaTagRegistry : MetaTagManagerRegistry
- $metaTags : array<string|int, mixed>
- $moveJsFromHeaderToFooter : bool
- $publicRequireJsConfig : array<string|int, mixed>
- Inline configuration for requireJS (public)
- $removeLineBreaksFromTemplate : bool
- $renderXhtml : bool
- $requireJsConfig : array<string|int, mixed>
- Inline configuration for requireJS (internal)
- $requireJsPath : string
- default path to the requireJS library, relative to the typo3/ directory
- $shortcutTag : string
- $templateFile : string
- $title : string
- The title of the page
- $titleTag : string
- $xmlPrologAndDocType : string
Methods
- __construct() : mixed
- addBodyContent() : mixed
- Adds content to body content
- addCssFile() : mixed
- Adds CSS file
- addCssInlineBlock() : mixed
- Adds CSS inline code
- addCssLibrary() : mixed
- Adds CSS file
- addFooterData() : mixed
- Adds footer data
- addHeaderData() : mixed
- Adds header data
- addInlineComment() : mixed
- Adds inline HTML comment
- addInlineLanguageLabel() : mixed
- Adds Javascript Inline Label. This will occur in TYPO3.lang - object The label can be used in scripts with TYPO3.lang.<key>
- addInlineLanguageLabelArray() : mixed
- Adds Javascript Inline Label Array. This will occur in TYPO3.lang - object The label can be used in scripts with TYPO3.lang.<key> Array will be merged with existing array.
- addInlineLanguageLabelFile() : mixed
- Gets labels to be used in JavaScript fetched from a locallang file.
- addInlineSetting() : mixed
- Adds Javascript Inline Setting. This will occur in TYPO3.settings - object The label can be used in scripts with TYPO3.setting.<key>
- addInlineSettingArray() : mixed
- Adds Javascript Inline Setting. This will occur in TYPO3.settings - object The label can be used in scripts with TYPO3.setting.<key> Array will be merged with existing array.
- addJsFile() : mixed
- Adds JS file
- addJsFooterFile() : mixed
- Adds JS file to footer
- addJsFooterInlineCode() : mixed
- Adds JS inline code to footer
- addJsFooterLibrary() : mixed
- Adds JS Library to Footer. JS Library block is rendered on top of the Footer JS files.
- addJsInlineCode() : mixed
- Adds JS inline code
- addJsLibrary() : mixed
- Adds JS Library. JS Library block is rendered on top of the JS files.
- addRequireJsConfiguration() : mixed
- Add additional configuration to require js.
- disableCompressCss() : mixed
- Disables compression of css
- disableCompressJavascript() : mixed
- Disables compression of javascript
- disableConcatenateCss() : mixed
- Disables concatenation of css files
- disableConcatenateJavascript() : mixed
- Disables concatenation of js files
- disableMoveJsFromHeaderToFooter() : mixed
- Disables MoveJsFromHeaderToFooter
- disableRemoveLineBreaksFromTemplate() : mixed
- Unsets removal of all line breaks in template
- enableCompressCss() : mixed
- Enables compression of css
- enableCompressJavascript() : mixed
- Enables compression of javascript
- enableConcatenateCss() : mixed
- Enables concatenation of css files
- enableConcatenateJavascript() : mixed
- Enables concatenation of js files
- enableDebugMode() : mixed
- Enables Debug Mode This is a shortcut to switch off all compress/concatenate features to enable easier debug
- enableMoveJsFromHeaderToFooter() : mixed
- Enables MoveJsFromHeaderToFooter
- enableRemoveLineBreaksFromTemplate() : mixed
- Sets removal of all line breaks in template
- getApplicationType() : string
- String 'FE' if in FrontendApplication, 'BE' otherwise (also in CLI without request object)
- getBaseUrl() : string
- Gets HTML base URL
- getBodyContent() : string
- Gets content for body
- getCharSet() : string
- Gets the charSet
- getCompressCss() : bool
- Gets compress of css
- getCompressJavascript() : bool
- Gets compress of javascript
- getConcatenateCss() : bool
- Gets concatenate of css files
- getConcatenateJavascript() : bool
- Gets concatenate of js files
- getFavIcon() : string
- Gets favicon
- getHeadTag() : string
- Gets head tag
- getHtmlTag() : string
- Gets html tag
- getIconMimeType() : string
- Gets icon mime type
- getInlineLanguageLabelFiles() : array<string|int, mixed>
- Gets the inline language files
- getInlineLanguageLabels() : array<string|int, mixed>
- Gets the inline language labels.
- getJavaScriptRenderer() : JavaScriptRenderer
- getLanguage() : string
- Gets the language
- getMetaCharsetTag() : string
- Get meta charset
- getMetaTag() : array<string|int, mixed>
- Returns the requested meta tag
- getMoveJsFromHeaderToFooter() : bool
- Gets MoveJsFromHeaderToFooter
- getRemoveLineBreaksFromTemplate() : bool
- Gets remove of empty lines from template
- getRenderXhtml() : bool
- Returns rendering mode XHTML or HTML
- getRequireJsConfig() : array<string|int, mixed>
- getState() : array<string|int, mixed>
- getTemplateFile() : string
- Gets template file
- getTitle() : string
- Gets the title
- loadRequireJs() : mixed
- Call function if you need the requireJS library this automatically adds the JavaScript path of all loaded extensions in the requireJS path option so it resolves names like TYPO3/CMS/MyExtension/MyJsFile to EXT:MyExtension/Resources/Public/JavaScript/MyJsFile.js when using requireJS
- loadRequireJsModule() : mixed
- includes an AMD-compatible JS file by resolving the ModuleName, and then requires the file via a requireJS request, additionally allowing to execute JavaScript code afterwards
- removeMetaTag() : mixed
- Unset the requested meta tag
- render() : string
- Render the page
- renderJavaScriptAndCssForProcessingOfUncachedContentObjects() : string
- Renders the JavaScript and CSS files that have been added during processing of uncached content objects (USER_INT, COA_INT)
- renderPageWithUncachedObjects() : string
- Render the page but not the JavaScript and CSS Files
- setBaseUrl() : mixed
- Sets HTML base URL
- setBodyContent() : mixed
- Sets Content for Body
- setCache() : mixed
- setCharSet() : mixed
- Sets meta charset
- setFavIcon() : mixed
- Sets favicon
- setHeadTag() : mixed
- Sets HTML head tag
- setHtmlTag() : mixed
- Sets html tag
- setIconMimeType() : mixed
- Sets icon mime type
- setLanguage() : mixed
- Sets language
- setMetaCharsetTag() : mixed
- Set the meta charset tag
- setMetaTag() : mixed
- Sets a given meta tag
- setRenderXhtml() : mixed
- Enables/disables rendering of XHTML code
- setRequireJsPath() : mixed
- Sets path to requireJS library (relative to typo3 directory)
- setTemplateFile() : mixed
- Sets template file
- setTitle() : mixed
- Sets the title
- setXmlPrologAndDocType() : mixed
- Sets xml prolog and docType
- updateState() : void
- addAjaxUrlsToInlineSettings() : mixed
- Make URLs to all backend ajax handlers available as inline setting.
- computeRequireJsConfig() : array<string|int, mixed>
- Computes the RequireJS configuration, mainly consisting of the paths to the core and all extension JavaScript resource folders plus some additional generic configuration.
- convertCharsetRecursivelyToUtf8() : mixed
- Small helper function to convert charsets for arrays into utf-8
- createInlineCssTagFromFile() : string
- Creates a CSS inline tag
- doCompress() : mixed
- Compresses inline code
- doCompressCss() : mixed
- Compresses CSS according to configuration.
- doCompressJavaScript() : mixed
- Compresses JavaScript according to configuration.
- doConcatenate() : mixed
- Concatenate files into one file registered handler
- doConcatenateCss() : mixed
- Concatenate CSS files according to configuration.
- doConcatenateJavaScript() : mixed
- Concatenate JavaScript files according to the configuration.
- executePostRenderHook() : mixed
- Execute postRenderHook for possible manipulation
- executePreRenderHook() : mixed
- Execute PreRenderHook for possible manipulation
- executeRenderPostTransformHook() : mixed
- PostTransform for possible manipulation of concatenated and compressed files
- filterArrayKeys() : array<string|int, mixed>
- findRequireJsBaseModuleName() : string|null
- Determines requireJS base module name (if defined).
- getAbsoluteWebPath() : string
- Gets absolute web path of filename for backend disposal.
- getCompressor() : ResourceCompressor
- Returns instance of \TYPO3\CMS\Core\Resource\ResourceCompressor
- getPathFixer() : RelativeCssPathFixer
- getPreparedMarkerArray() : array<string|int, mixed>
- Fills the marker array with the given strings and trims each value
- getPreparedMarkerArrayForPageWithUncachedObjects() : array<string|int, mixed>
- Fills the marker array with the given strings and trims each value
- getRequireJsLoader() : string
- Generates RequireJS loader HTML markup.
- getStreamlinedFileName() : string
- This function acts as a wrapper to allow relative and paths starting with EXT: to be dealt with in this very case to always return the absolute web path to be included directly before output.
- getTemplate() : string
- Reads the template file and returns the requested part as string
- includeLanguageFileForInline() : mixed
- Include language file for inline usage
- loadJavaScriptLanguageStrings() : mixed
- Load the language strings into JavaScript
- parseLanguageLabelsForJavaScript() : array<string|int, mixed>
- Converts the language labels for usage in JavaScript
- prepareRendering() : mixed
- Remove ending slashes from static header block if the page is being rendered as html (not xhtml) and define property $this->endingSlash for further use
- processJsFile() : string
- Processes a Javascript file dependent on the current context
- readLLfile() : array<string|int, mixed>
- Reads a locallang file.
- renderAdditionalJavaScriptLibraries() : array<string|int, mixed>|array<string|int, string>
- Render JavaScript libraries
- renderCssFiles() : string
- Render CSS files
- renderCssInline() : string
- Render inline CSS
- renderCssLibraries() : string
- Render CSS library files
- renderInlineJavaScript() : array<string|int, mixed>|array<string|int, string>
- Render inline JavaScript
- renderJavaScriptAndCss() : array<string|int, mixed>|array<string|int, string>
- Renders all JavaScript and CSS
- renderJavaScriptFiles() : array<string|int, mixed>|array<string|int, string>
- Render JavaScript files
- renderMainJavaScriptLibraries() : string
- Helper function for render the main JavaScript libraries, currently: RequireJS
- renderMetaTagsFromAPI() : array<string|int, mixed>
- Renders metaTags based on tags added via the API
- reset() : mixed
- Reset all vars to initial values
Constants
REQUIREJS_SCOPE_CONFIG
public
mixed
REQUIREJS_SCOPE_CONFIG
= 'config'
REQUIREJS_SCOPE_RESOLVE
public
mixed
REQUIREJS_SCOPE_RESOLVE
= 'resolve'
PART_COMPLETE
protected
mixed
PART_COMPLETE
= 0
PART_FOOTER
protected
mixed
PART_FOOTER
= 2
PART_HEADER
protected
mixed
PART_HEADER
= 1
Properties
$additionalRequireJsConfig
Inline configuration for requireJS from extensions
protected
array<string|int, mixed>
$additionalRequireJsConfig
= []
$addRequireJs
if set, the requireJS library is included
protected
bool
$addRequireJs
= false
$baseUrl
protected
string
$baseUrl
$baseUrlTag
protected
string
$baseUrlTag
= '<base href="|" />'
$bodyContent
protected
string
$bodyContent
$cache
protected
static FrontendInterface
$cache
$charSet
Charset for the rendering
protected
string
$charSet
$compressCss
protected
bool
$compressCss
= false
$compressJavascript
protected
bool
$compressJavascript
= false
$compressor
protected
ResourceCompressor
$compressor
$concatenateCss
protected
bool
$concatenateCss
= false
$concatenateJavascript
protected
bool
$concatenateJavascript
= false
$cssFiles
protected
array<string, array<string|int, mixed>>
$cssFiles
= []
$cssInline
protected
array<string, array<string|int, mixed>>
$cssInline
= []
$cssLibs
protected
array<string, array<string|int, mixed>>
$cssLibs
= []
$endingSlash
Is empty string for HTML and ' /' for XHTML rendering
protected
string
$endingSlash
= ''
$favIcon
protected
string
$favIcon
$footerData
protected
array<string|int, mixed>
$footerData
= []
$headerData
protected
array<string|int, mixed>
$headerData
= []
$headTag
protected
string
$headTag
= '<head>'
$htmlTag
protected
string
$htmlTag
= '<html>'
$iconMimeType
protected
string
$iconMimeType
= ''
$inlineComments
protected
array<string|int, mixed>
$inlineComments
= []
$inlineCssWrap
protected
array<string|int, mixed>
$inlineCssWrap
= ['<style>' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF, '-->' . LF . '/*]]>*/' . LF . '</style>' . LF]
$inlineJavascriptWrap
protected
array{0: string, 1: string}
$inlineJavascriptWrap
= ['<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF, '/*]]>*/' . LF . '</script>' . LF]
$inlineLanguageLabelFiles
protected
array<string|int, mixed>
$inlineLanguageLabelFiles
= []
$inlineLanguageLabels
protected
array<string|int, mixed>
$inlineLanguageLabels
= []
$inlineSettings
protected
array<string|int, mixed>
$inlineSettings
= []
$internalRequireJsPathModuleNames
Module names of internal requireJS 'paths'
protected
array<string|int, mixed>
$internalRequireJsPathModuleNames
= []
$javaScriptRenderer
protected
JavaScriptRenderer
$javaScriptRenderer
$jsFiles
protected
array<string, array<string|int, mixed>>
$jsFiles
= []
$jsFooterFiles
protected
array<string|int, mixed>
$jsFooterFiles
= []
$jsFooterInline
protected
array<string|int, mixed>
$jsFooterInline
= []
$jsFooterLibs
protected
array<string|int, mixed>
$jsFooterLibs
= []
$jsInline
protected
array<string, array<string|int, mixed>>
$jsInline
= []
$jsLibs
protected
array<string|int, mixed>
$jsLibs
= []
$lang
The language key Two character string or 'default'
protected
string
$lang
$languageDependencies
List of language dependencies for actual language. This is used for local variants of a language that depend on their "main" language, like Brazilian Portuguese or Canadian French.
protected
array<string|int, mixed>
$languageDependencies
= []
$locales
protected
Locales
$locales
$metaCharsetTag
protected
string
$metaCharsetTag
= '<meta http-equiv="Content-Type" content="text/html; charset=|" />'
$metaTagRegistry
protected
MetaTagManagerRegistry
$metaTagRegistry
$metaTags
protected
array<string|int, mixed>
$metaTags
= []
$moveJsFromHeaderToFooter
protected
bool
$moveJsFromHeaderToFooter
= false
$publicRequireJsConfig
Inline configuration for requireJS (public)
protected
array<string|int, mixed>
$publicRequireJsConfig
= []
$removeLineBreaksFromTemplate
protected
bool
$removeLineBreaksFromTemplate
= false
$renderXhtml
protected
bool
$renderXhtml
= true
$requireJsConfig
Inline configuration for requireJS (internal)
protected
array<string|int, mixed>
$requireJsConfig
= []
$requireJsPath
default path to the requireJS library, relative to the typo3/ directory
protected
string
$requireJsPath
= 'EXT:core/Resources/Public/JavaScript/Contrib/'
$shortcutTag
protected
string
$shortcutTag
= '<link rel="icon" href="%1$s"%2$s />'
$templateFile
protected
string
$templateFile
$title
The title of the page
protected
string
$title
$titleTag
protected
string
$titleTag
= '<title>|</title>'
$xmlPrologAndDocType
protected
string
$xmlPrologAndDocType
= ''
Methods
__construct()
public
__construct([string $templateFile = '' ]) : mixed
Parameters
- $templateFile : string = ''
-
Declare the used template file. Omit this parameter will use default template
addBodyContent()
Adds content to body content
public
addBodyContent(string $content) : mixed
Parameters
- $content : string
addCssFile()
Adds CSS file
public
addCssFile(string $file[, string $rel = 'stylesheet' ][, string $media = 'all' ][, string $title = '' ][, bool $compress = true ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $inline = false ]) : mixed
Parameters
- $file : string
- $rel : string = 'stylesheet'
- $media : string = 'all'
- $title : string = ''
- $compress : bool = true
- $forceOnTop : bool = false
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $inline : bool = false
addCssInlineBlock()
Adds CSS inline code
public
addCssInlineBlock(string $name, string $block[, bool $compress = false ][, bool $forceOnTop = false ]) : mixed
Parameters
- $name : string
- $block : string
- $compress : bool = false
- $forceOnTop : bool = false
addCssLibrary()
Adds CSS file
public
addCssLibrary(string $file[, string $rel = 'stylesheet' ][, string $media = 'all' ][, string $title = '' ][, bool $compress = true ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $inline = false ]) : mixed
Parameters
- $file : string
- $rel : string = 'stylesheet'
- $media : string = 'all'
- $title : string = ''
- $compress : bool = true
- $forceOnTop : bool = false
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $inline : bool = false
addFooterData()
Adds footer data
public
addFooterData(string $data) : mixed
Parameters
- $data : string
-
Free header data for HTML header
addHeaderData()
Adds header data
public
addHeaderData(string $data) : mixed
Parameters
- $data : string
-
Free header data for HTML header
addInlineComment()
Adds inline HTML comment
public
addInlineComment(string $comment) : mixed
Parameters
- $comment : string
addInlineLanguageLabel()
Adds Javascript Inline Label. This will occur in TYPO3.lang - object The label can be used in scripts with TYPO3.lang.<key>
public
addInlineLanguageLabel(string $key, string $value) : mixed
Parameters
- $key : string
- $value : string
addInlineLanguageLabelArray()
Adds Javascript Inline Label Array. This will occur in TYPO3.lang - object The label can be used in scripts with TYPO3.lang.<key> Array will be merged with existing array.
public
addInlineLanguageLabelArray(array<string|int, mixed> $array) : mixed
Parameters
- $array : array<string|int, mixed>
addInlineLanguageLabelFile()
Gets labels to be used in JavaScript fetched from a locallang file.
public
addInlineLanguageLabelFile(string $fileRef[, string $selectionPrefix = '' ][, string $stripFromSelectionName = '' ]) : mixed
Parameters
- $fileRef : string
-
Input is a file-reference (see GeneralUtility::getFileAbsFileName). That file is expected to be a 'locallang.xlf' file containing a valid XML TYPO3 language structure.
- $selectionPrefix : string = ''
-
Prefix to select the correct labels (default: '')
- $stripFromSelectionName : string = ''
-
String to be removed from the label names in the output. (default: '')
addInlineSetting()
Adds Javascript Inline Setting. This will occur in TYPO3.settings - object The label can be used in scripts with TYPO3.setting.<key>
public
addInlineSetting(string $namespace, string $key, mixed $value) : mixed
Parameters
- $namespace : string
- $key : string
- $value : mixed
addInlineSettingArray()
Adds Javascript Inline Setting. This will occur in TYPO3.settings - object The label can be used in scripts with TYPO3.setting.<key> Array will be merged with existing array.
public
addInlineSettingArray(string $namespace, array<string|int, mixed> $array) : mixed
Parameters
- $namespace : string
- $array : array<string|int, mixed>
addJsFile()
Adds JS file
public
addJsFile(string $file[, string $type = 'text/javascript' ][, bool $compress = true ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $async = false ][, string $integrity = '' ][, bool $defer = false ][, string $crossorigin = '' ][, bool $nomodule = false ]) : mixed
Parameters
- $file : string
-
File name
- $type : string = 'text/javascript'
-
Content Type
- $compress : bool = true
- $forceOnTop : bool = false
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $async : bool = false
-
Flag if property 'async="async"' should be added to JavaScript tags
- $integrity : string = ''
-
Subresource Integrity (SRI)
- $defer : bool = false
-
Flag if property 'defer="defer"' should be added to JavaScript tags
- $crossorigin : string = ''
-
CORS settings attribute
- $nomodule : bool = false
-
Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
addJsFooterFile()
Adds JS file to footer
public
addJsFooterFile(string $file[, string $type = 'text/javascript' ][, bool $compress = true ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $async = false ][, string $integrity = '' ][, bool $defer = false ][, string $crossorigin = '' ][, bool $nomodule = false ]) : mixed
Parameters
- $file : string
-
File name
- $type : string = 'text/javascript'
-
Content Type
- $compress : bool = true
- $forceOnTop : bool = false
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $async : bool = false
-
Flag if property 'async="async"' should be added to JavaScript tags
- $integrity : string = ''
-
Subresource Integrity (SRI)
- $defer : bool = false
-
Flag if property 'defer="defer"' should be added to JavaScript tags
- $crossorigin : string = ''
-
CORS settings attribute
- $nomodule : bool = false
-
Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
addJsFooterInlineCode()
Adds JS inline code to footer
public
addJsFooterInlineCode(string $name, string $block[, bool $compress = true ][, bool $forceOnTop = false ]) : mixed
Parameters
- $name : string
- $block : string
- $compress : bool = true
- $forceOnTop : bool = false
addJsFooterLibrary()
Adds JS Library to Footer. JS Library block is rendered on top of the Footer JS files.
public
addJsFooterLibrary(string $name, string $file[, string $type = 'text/javascript' ][, bool $compress = false ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $async = false ][, string $integrity = '' ][, bool $defer = false ][, string $crossorigin = '' ][, bool $nomodule = false ]) : mixed
Parameters
- $name : string
-
Arbitrary identifier
- $file : string
-
File name
- $type : string = 'text/javascript'
-
Content Type
- $compress : bool = false
-
Flag if library should be compressed
- $forceOnTop : bool = false
-
Flag if added library should be inserted at begin of this block
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $async : bool = false
-
Flag if property 'async="async"' should be added to JavaScript tags
- $integrity : string = ''
-
Subresource Integrity (SRI)
- $defer : bool = false
-
Flag if property 'defer="defer"' should be added to JavaScript tags
- $crossorigin : string = ''
-
CORS settings attribute
- $nomodule : bool = false
-
Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
addJsInlineCode()
Adds JS inline code
public
addJsInlineCode(string $name, string $block[, bool $compress = true ][, bool $forceOnTop = false ]) : mixed
Parameters
- $name : string
- $block : string
- $compress : bool = true
- $forceOnTop : bool = false
addJsLibrary()
Adds JS Library. JS Library block is rendered on top of the JS files.
public
addJsLibrary(string $name, string $file[, string $type = 'text/javascript' ][, bool $compress = false ][, bool $forceOnTop = false ][, string $allWrap = '' ][, bool $excludeFromConcatenation = false ][, string $splitChar = '|' ][, bool $async = false ][, string $integrity = '' ][, bool $defer = false ][, string $crossorigin = '' ][, bool $nomodule = false ]) : mixed
Parameters
- $name : string
-
Arbitrary identifier
- $file : string
-
File name
- $type : string = 'text/javascript'
-
Content Type
- $compress : bool = false
-
Flag if library should be compressed
- $forceOnTop : bool = false
-
Flag if added library should be inserted at begin of this block
- $allWrap : string = ''
- $excludeFromConcatenation : bool = false
- $splitChar : string = '|'
-
The char used to split the allWrap value, default is "|"
- $async : bool = false
-
Flag if property 'async="async"' should be added to JavaScript tags
- $integrity : string = ''
-
Subresource Integrity (SRI)
- $defer : bool = false
-
Flag if property 'defer="defer"' should be added to JavaScript tags
- $crossorigin : string = ''
-
CORS settings attribute
- $nomodule : bool = false
-
Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
addRequireJsConfiguration()
Add additional configuration to require js.
public
addRequireJsConfiguration(array<string|int, mixed> $configuration) : mixed
Configuration will be merged recursive with overrule.
To add another path mapping deliver the following configuration: 'paths' => array( 'EXTERN/mybootstrapjs' => 'sysext/.../twbs/bootstrap.min', ),
Parameters
- $configuration : array<string|int, mixed>
-
The configuration that will be merged with existing one.
disableCompressCss()
Disables compression of css
public
disableCompressCss() : mixed
disableCompressJavascript()
Disables compression of javascript
public
disableCompressJavascript() : mixed
disableConcatenateCss()
Disables concatenation of css files
public
disableConcatenateCss() : mixed
disableConcatenateJavascript()
Disables concatenation of js files
public
disableConcatenateJavascript() : mixed
disableMoveJsFromHeaderToFooter()
Disables MoveJsFromHeaderToFooter
public
disableMoveJsFromHeaderToFooter() : mixed
disableRemoveLineBreaksFromTemplate()
Unsets removal of all line breaks in template
public
disableRemoveLineBreaksFromTemplate() : mixed
enableCompressCss()
Enables compression of css
public
enableCompressCss() : mixed
enableCompressJavascript()
Enables compression of javascript
public
enableCompressJavascript() : mixed
enableConcatenateCss()
Enables concatenation of css files
public
enableConcatenateCss() : mixed
enableConcatenateJavascript()
Enables concatenation of js files
public
enableConcatenateJavascript() : mixed
enableDebugMode()
Enables Debug Mode This is a shortcut to switch off all compress/concatenate features to enable easier debug
public
enableDebugMode() : mixed
enableMoveJsFromHeaderToFooter()
Enables MoveJsFromHeaderToFooter
public
enableMoveJsFromHeaderToFooter() : mixed
enableRemoveLineBreaksFromTemplate()
Sets removal of all line breaks in template
public
enableRemoveLineBreaksFromTemplate() : mixed
getApplicationType()
String 'FE' if in FrontendApplication, 'BE' otherwise (also in CLI without request object)
public
getApplicationType() : string
Return values
stringgetBaseUrl()
Gets HTML base URL
public
getBaseUrl() : string
Return values
string —$url
getBodyContent()
Gets content for body
public
getBodyContent() : string
Return values
stringgetCharSet()
Gets the charSet
public
getCharSet() : string
Return values
string —$charSet
getCompressCss()
Gets compress of css
public
getCompressCss() : bool
Return values
boolgetCompressJavascript()
Gets compress of javascript
public
getCompressJavascript() : bool
Return values
boolgetConcatenateCss()
Gets concatenate of css files
public
getConcatenateCss() : bool
Return values
boolgetConcatenateJavascript()
Gets concatenate of js files
public
getConcatenateJavascript() : bool
Return values
boolgetFavIcon()
Gets favicon
public
getFavIcon() : string
Return values
string —$favIcon
getHeadTag()
Gets head tag
public
getHeadTag() : string
Return values
string —$tag Head tag
getHtmlTag()
Gets html tag
public
getHtmlTag() : string
Return values
string —$htmlTag Html tag
getIconMimeType()
Gets icon mime type
public
getIconMimeType() : string
Return values
string —$iconMimeType
getInlineLanguageLabelFiles()
Gets the inline language files
public
getInlineLanguageLabelFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>getInlineLanguageLabels()
Gets the inline language labels.
public
getInlineLanguageLabels() : array<string|int, mixed>
Return values
array<string|int, mixed> —The inline language labels
getJavaScriptRenderer()
public
getJavaScriptRenderer() : JavaScriptRenderer
Return values
JavaScriptRenderergetLanguage()
Gets the language
public
getLanguage() : string
Return values
string —$lang
getMetaCharsetTag()
Get meta charset
public
getMetaCharsetTag() : string
Return values
stringgetMetaTag()
Returns the requested meta tag
public
getMetaTag(string $type, string $name) : array<string|int, mixed>
Parameters
- $type : string
- $name : string
Return values
array<string|int, mixed>getMoveJsFromHeaderToFooter()
Gets MoveJsFromHeaderToFooter
public
getMoveJsFromHeaderToFooter() : bool
Return values
boolgetRemoveLineBreaksFromTemplate()
Gets remove of empty lines from template
public
getRemoveLineBreaksFromTemplate() : bool
Return values
boolgetRenderXhtml()
Returns rendering mode XHTML or HTML
public
getRenderXhtml() : bool
Return values
bool —TRUE if XHTML, FALSE if HTML
getRequireJsConfig()
public
getRequireJsConfig([string|null $scope = null ]) : array<string|int, mixed>
Parameters
- $scope : string|null = null
Return values
array<string|int, mixed>getState()
public
getState() : array<string|int, mixed>
Return values
array<string|int, mixed>getTemplateFile()
Gets template file
public
getTemplateFile() : string
Return values
stringgetTitle()
Gets the title
public
getTitle() : string
Return values
string —$title Title of webpage
loadRequireJs()
Call function if you need the requireJS library this automatically adds the JavaScript path of all loaded extensions in the requireJS path option so it resolves names like TYPO3/CMS/MyExtension/MyJsFile to EXT:MyExtension/Resources/Public/JavaScript/MyJsFile.js when using requireJS
public
loadRequireJs() : mixed
loadRequireJsModule()
includes an AMD-compatible JS file by resolving the ModuleName, and then requires the file via a requireJS request, additionally allowing to execute JavaScript code afterwards
public
loadRequireJsModule(string $mainModuleName[, string $callBackFunction = null ]) : mixed
this function only works for AMD-ready JS modules, used like "define('TYPO3/CMS/Backend/FormEngine..." in the JS file
TYPO3/CMS/Backend/FormEngine => "TYPO3": Vendor Name "CMS": Product Name "Backend": Extension Name "FormEngine": FileName in the Resources/Public/JavaScript folder
Parameters
- $mainModuleName : string
-
Must be in the form of "TYPO3/CMS/PackageName/ModuleName" e.g. "TYPO3/CMS/Backend/FormEngine"
- $callBackFunction : string = null
-
loaded right after the requireJS loading, must be wrapped in function() }
removeMetaTag()
Unset the requested meta tag
public
removeMetaTag(string $type, string $name) : mixed
Parameters
- $type : string
- $name : string
render()
Render the page
public
render() : string
Return values
string —Content of rendered page
renderJavaScriptAndCssForProcessingOfUncachedContentObjects()
Renders the JavaScript and CSS files that have been added during processing of uncached content objects (USER_INT, COA_INT)
public
renderJavaScriptAndCssForProcessingOfUncachedContentObjects(string $cachedPageContent, string $substituteHash) : string
Parameters
- $cachedPageContent : string
- $substituteHash : string
-
The hash that is used for the variables
Return values
stringrenderPageWithUncachedObjects()
Render the page but not the JavaScript and CSS Files
public
renderPageWithUncachedObjects(string $substituteHash) : string
Parameters
- $substituteHash : string
-
The hash that is used for the placeholder markers
Return values
string —Content of rendered page
setBaseUrl()
Sets HTML base URL
public
setBaseUrl(string $baseUrl) : mixed
Parameters
- $baseUrl : string
-
HTML base URL
setBodyContent()
Sets Content for Body
public
setBodyContent(string $content) : mixed
Parameters
- $content : string
setCache()
public
static setCache(FrontendInterface $cache) : mixed
Parameters
- $cache : FrontendInterface
setCharSet()
Sets meta charset
public
setCharSet(string $charSet) : mixed
Parameters
- $charSet : string
-
Used charset
setFavIcon()
Sets favicon
public
setFavIcon(string $favIcon) : mixed
Parameters
- $favIcon : string
setHeadTag()
Sets HTML head tag
public
setHeadTag(string $headTag) : mixed
Parameters
- $headTag : string
-
HTML head tag
setHtmlTag()
Sets html tag
public
setHtmlTag(string $htmlTag) : mixed
Parameters
- $htmlTag : string
-
Html tag
setIconMimeType()
Sets icon mime type
public
setIconMimeType(string $iconMimeType) : mixed
Parameters
- $iconMimeType : string
setLanguage()
Sets language
public
setLanguage(string $lang) : mixed
Parameters
- $lang : string
-
Used language
setMetaCharsetTag()
Set the meta charset tag
public
setMetaCharsetTag(string $metaCharsetTag) : mixed
Parameters
- $metaCharsetTag : string
setMetaTag()
Sets a given meta tag
public
setMetaTag(string $type, string $name, string $content[, array<string|int, mixed> $subProperties = [] ][, bool $replace = true ]) : mixed
Parameters
- $type : string
-
The type of the meta tag. Allowed values are property, name or http-equiv
- $name : string
-
The name of the property to add
- $content : string
-
The content of the meta tag
- $subProperties : array<string|int, mixed> = []
-
Subproperties of the meta tag (like e.g. og:image:width)
- $replace : bool = true
-
Replace earlier set meta tag
Tags
setRenderXhtml()
Enables/disables rendering of XHTML code
public
setRenderXhtml(bool $enable) : mixed
Parameters
- $enable : bool
-
Enable XHTML
setRequireJsPath()
Sets path to requireJS library (relative to typo3 directory)
public
setRequireJsPath(string $path) : mixed
Parameters
- $path : string
-
Path to requireJS library
setTemplateFile()
Sets template file
public
setTemplateFile(string $file) : mixed
Parameters
- $file : string
setTitle()
Sets the title
public
setTitle(string $title) : mixed
Parameters
- $title : string
-
title of webpage
setXmlPrologAndDocType()
Sets xml prolog and docType
public
setXmlPrologAndDocType(string $xmlPrologAndDocType) : mixed
Parameters
- $xmlPrologAndDocType : string
-
Complete tags for xml prolog and docType
updateState()
public
updateState(array<string|int, mixed> $newState) : void
Parameters
- $newState : array<string|int, mixed>
addAjaxUrlsToInlineSettings()
Make URLs to all backend ajax handlers available as inline setting.
protected
addAjaxUrlsToInlineSettings([bool $publicRoutesOnly = false ]) : mixed
Parameters
- $publicRoutesOnly : bool = false
computeRequireJsConfig()
Computes the RequireJS configuration, mainly consisting of the paths to the core and all extension JavaScript resource folders plus some additional generic configuration.
protected
computeRequireJsConfig(bool $isDevelopment, array<string, PackageInterface> $packages) : array<string|int, mixed>
Parameters
- $isDevelopment : bool
- $packages : array<string, PackageInterface>
Return values
array<string|int, mixed> —The RequireJS configuration
convertCharsetRecursivelyToUtf8()
Small helper function to convert charsets for arrays into utf-8
protected
convertCharsetRecursivelyToUtf8(mixed &$data, string $fromCharset) : mixed
Parameters
- $data : mixed
-
given by reference (string/array usually)
- $fromCharset : string
-
convert FROM this charset
createInlineCssTagFromFile()
Creates a CSS inline tag
protected
createInlineCssTagFromFile(string $file, array<string|int, mixed> $properties) : string
Parameters
- $file : string
-
the filename to process
- $properties : array<string|int, mixed>
Return values
stringdoCompress()
Compresses inline code
protected
doCompress() : mixed
doCompressCss()
Compresses CSS according to configuration.
protected
doCompressCss() : mixed
doCompressJavaScript()
Compresses JavaScript according to configuration.
protected
doCompressJavaScript() : mixed
doConcatenate()
Concatenate files into one file registered handler
protected
doConcatenate() : mixed
doConcatenateCss()
Concatenate CSS files according to configuration.
protected
doConcatenateCss() : mixed
doConcatenateJavaScript()
Concatenate JavaScript files according to the configuration.
protected
doConcatenateJavaScript() : mixed
executePostRenderHook()
Execute postRenderHook for possible manipulation
protected
executePostRenderHook(string &$jsLibs, string &$jsFiles, string &$jsFooterFiles, string &$cssLibs, string &$cssFiles, string &$jsInline, string &$cssInline, string &$jsFooterInline, string &$jsFooterLibs) : mixed
Parameters
- $jsLibs : string
- $jsFiles : string
- $jsFooterFiles : string
- $cssLibs : string
- $cssFiles : string
- $jsInline : string
- $cssInline : string
- $jsFooterInline : string
- $jsFooterLibs : string
executePreRenderHook()
Execute PreRenderHook for possible manipulation
protected
executePreRenderHook() : mixed
executeRenderPostTransformHook()
PostTransform for possible manipulation of concatenated and compressed files
protected
executeRenderPostTransformHook() : mixed
filterArrayKeys()
protected
filterArrayKeys(array<string|int, mixed> $array, array<string|int, string> $keys[, bool $keep = true ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
- $keys : array<string|int, string>
- $keep : bool = true
Return values
array<string|int, mixed>findRequireJsBaseModuleName()
Determines requireJS base module name (if defined).
protected
findRequireJsBaseModuleName(string $moduleName) : string|null
Parameters
- $moduleName : string
Return values
string|nullgetAbsoluteWebPath()
Gets absolute web path of filename for backend disposal.
protected
getAbsoluteWebPath(string $file) : string
Resolving the absolute path in the frontend with conflict with applying config.absRefPrefix in frontend rendering process.
Parameters
- $file : string
Tags
Return values
stringgetCompressor()
Returns instance of \TYPO3\CMS\Core\Resource\ResourceCompressor
protected
getCompressor() : ResourceCompressor
Return values
ResourceCompressorgetPathFixer()
protected
getPathFixer() : RelativeCssPathFixer
Return values
RelativeCssPathFixergetPreparedMarkerArray()
Fills the marker array with the given strings and trims each value
protected
getPreparedMarkerArray(string $jsLibs, string $jsFiles, string $jsFooterFiles, string $cssLibs, string $cssFiles, string $jsInline, string $cssInline, string $jsFooterInline, string $jsFooterLibs, string $metaTags) : array<string|int, mixed>
Parameters
- $jsLibs : string
- $jsFiles : string
- $jsFooterFiles : string
- $cssLibs : string
- $cssFiles : string
- $jsInline : string
- $cssInline : string
- $jsFooterInline : string
- $jsFooterLibs : string
- $metaTags : string
Return values
array<string|int, mixed> —Marker array
getPreparedMarkerArrayForPageWithUncachedObjects()
Fills the marker array with the given strings and trims each value
protected
getPreparedMarkerArrayForPageWithUncachedObjects(string $substituteHash) : array<string|int, mixed>
Parameters
- $substituteHash : string
-
The hash that is used for the placeholder markers
Return values
array<string|int, mixed> —Marker array
getRequireJsLoader()
Generates RequireJS loader HTML markup.
protected
getRequireJsLoader() : string
Tags
Return values
stringgetStreamlinedFileName()
This function acts as a wrapper to allow relative and paths starting with EXT: to be dealt with in this very case to always return the absolute web path to be included directly before output.
protected
getStreamlinedFileName(string $file[, bool $prepareForOutput = true ]) : string
This is mainly added so the EXT: syntax can be resolved for PageRenderer in one central place, and hopefully removed in the future by one standard API call.
Parameters
- $file : string
-
the filename to process
- $prepareForOutput : bool = true
-
whether the file should be prepared as version numbered file and prefixed as absolute webpath
Return values
stringgetTemplate()
Reads the template file and returns the requested part as string
protected
getTemplate() : string
Return values
stringincludeLanguageFileForInline()
Include language file for inline usage
protected
includeLanguageFileForInline(string $fileRef[, string $selectionPrefix = '' ][, string $stripFromSelectionName = '' ]) : mixed
Parameters
- $fileRef : string
- $selectionPrefix : string = ''
- $stripFromSelectionName : string = ''
Tags
loadJavaScriptLanguageStrings()
Load the language strings into JavaScript
protected
loadJavaScriptLanguageStrings() : mixed
parseLanguageLabelsForJavaScript()
Converts the language labels for usage in JavaScript
protected
parseLanguageLabelsForJavaScript() : array<string|int, mixed>
Return values
array<string|int, mixed>prepareRendering()
Remove ending slashes from static header block if the page is being rendered as html (not xhtml) and define property $this->endingSlash for further use
protected
prepareRendering() : mixed
processJsFile()
Processes a Javascript file dependent on the current context
protected
processJsFile(string $filename) : string
Adds the version number for Frontend, compresses the file for Backend
Parameters
- $filename : string
-
Filename
Return values
string —New filename
readLLfile()
Reads a locallang file.
protected
readLLfile(string $fileRef) : array<string|int, mixed>
Parameters
- $fileRef : string
-
Reference to a relative filename to include.
Return values
array<string|int, mixed> —Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
renderAdditionalJavaScriptLibraries()
Render JavaScript libraries
protected
renderAdditionalJavaScriptLibraries() : array<string|int, mixed>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, string> —jsLibs and jsFooterLibs strings
renderCssFiles()
Render CSS files
protected
renderCssFiles() : string
Return values
stringrenderCssInline()
Render inline CSS
protected
renderCssInline() : string
Return values
stringrenderCssLibraries()
Render CSS library files
protected
renderCssLibraries() : string
Return values
stringrenderInlineJavaScript()
Render inline JavaScript
protected
renderInlineJavaScript() : array<string|int, mixed>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, string> —jsInline and jsFooterInline string
renderJavaScriptAndCss()
Renders all JavaScript and CSS
protected
renderJavaScriptAndCss() : array<string|int, mixed>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, string>renderJavaScriptFiles()
Render JavaScript files
protected
renderJavaScriptFiles() : array<string|int, mixed>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, string> —jsFiles and jsFooterFiles strings
renderMainJavaScriptLibraries()
Helper function for render the main JavaScript libraries, currently: RequireJS
protected
renderMainJavaScriptLibraries() : string
Return values
string —Content with JavaScript libraries
renderMetaTagsFromAPI()
Renders metaTags based on tags added via the API
protected
renderMetaTagsFromAPI() : array<string|int, mixed>
Return values
array<string|int, mixed>reset()
Reset all vars to initial values
protected
reset() : mixed