PageRenderer

class \TYPO3\CMS\Core\Page\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  : mixed = 'config'
REQUIREJS_SCOPE_RESOLVE  : mixed = 'resolve'
PART_COMPLETE  : mixed = 0
PART_FOOTER  : mixed = 2
PART_HEADER  : mixed = 1

Properties

$additionalRequireJsConfig  : array
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>
$cssInline  : array<string, array>
$cssLibs  : array<string, array>
$endingSlash  : string
Is empty string for HTML and ' /' for XHTML rendering
$favIcon  : string
$footerData  : array
$headerData  : array
$headTag  : string
$htmlTag  : string
$iconMimeType  : string
$inlineComments  : array
$inlineCssWrap  : array
$inlineJavascriptWrap  : array{0: string, 1: string}
$inlineLanguageLabelFiles  : array
$inlineLanguageLabels  : array
$inlineSettings  : array
$internalRequireJsPathModuleNames  : array
Module names of internal requireJS 'paths'
$javaScriptRenderer  : JavaScriptRenderer
$jsFiles  : array<string, array>
$jsFooterFiles  : array
$jsFooterInline  : array
$jsFooterLibs  : array
$jsInline  : array<string, array>
$jsLibs  : array
$lang  : string
The language key Two character string or 'default'
$languageDependencies  : array
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
$moveJsFromHeaderToFooter  : bool
$publicRequireJsConfig  : array
Inline configuration for requireJS (public)
$removeLineBreaksFromTemplate  : bool
$renderXhtml  : bool
$requireJsConfig  : array
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
Gets the inline language files
getInlineLanguageLabels()  : array
Gets the inline language labels.
getJavaScriptRenderer()  : JavaScriptRenderer
getLanguage()  : string
Gets the language
getMetaCharsetTag()  : string
Get meta charset
getMetaTag()  : array
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
getState()  : array
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
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
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
Fills the marker array with the given strings and trims each value
getPreparedMarkerArrayForPageWithUncachedObjects()  : array
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
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
Reads a locallang file.
renderAdditionalJavaScriptLibraries()  : array|string[]
Render JavaScript libraries
renderCssFiles()  : string
Render CSS files
renderCssInline()  : string
Render inline CSS
renderCssLibraries()  : string
Render CSS library files
renderInlineJavaScript()  : array|string[]
Render inline JavaScript
renderJavaScriptAndCss()  : array|string[]
Renders all JavaScript and CSS
renderJavaScriptFiles()  : array|string[]
Render JavaScript files
renderMainJavaScriptLibraries()  : string
Helper function for render the main JavaScript libraries, currently: RequireJS
renderMetaTagsFromAPI()  : array
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
protected mixed PART_FOOTER = 2

PART_HEADER

protected mixed PART_HEADER = 1

Properties

$additionalRequireJsConfig

Inline configuration for requireJS from extensions

protected array $additionalRequireJsConfig = []

$addRequireJs

if set, the requireJS library is included

protected bool $addRequireJs = false

$baseUrlTag

protected string $baseUrlTag = '<base href="|" />'

$charSet

Charset for the rendering

protected string $charSet

$compressCss

protected bool $compressCss = false

$compressJavascript

protected bool $compressJavascript = false

$concatenateCss

protected bool $concatenateCss = false

$concatenateJavascript

protected bool $concatenateJavascript = false

$cssFiles

protected array<string, array> $cssFiles = []

$cssInline

protected array<string, array> $cssInline = []

$cssLibs

protected array<string, array> $cssLibs = []

$endingSlash

Is empty string for HTML and ' /' for XHTML rendering

protected string $endingSlash = ''

$footerData

protected array $footerData = []

$headerData

protected array $headerData = []

$headTag

protected string $headTag = '<head>'

$htmlTag

protected string $htmlTag = '<html>'

$iconMimeType

protected string $iconMimeType = ''

$inlineComments

protected array $inlineComments = []

$inlineCssWrap

protected array $inlineCssWrap = ['<style>' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF, '-->'…
Show the full value['<style>' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF, '-->' . LF . '/*]]>*/' . LF . '</style>' . LF]

$inlineJavascriptWrap

protected array{0: string, 1: string} $inlineJavascriptWrap = ['<script type="text/javascript">' . LF . '/*<![CDATA[*/' . …
Show the full value['<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF, '/*]]>*/' . LF . '</script>' . LF]

$inlineLanguageLabelFiles

protected array $inlineLanguageLabelFiles = []

$inlineLanguageLabels

protected array $inlineLanguageLabels = []

$inlineSettings

protected array $inlineSettings = []

$internalRequireJsPathModuleNames

Module names of internal requireJS 'paths'

protected array $internalRequireJsPathModuleNames = []

$jsFiles

protected array<string, array> $jsFiles = []

$jsFooterFiles

protected array $jsFooterFiles = []

$jsFooterInline

protected array $jsFooterInline = []

$jsFooterLibs

protected array $jsFooterLibs = []

$jsInline

protected array<string, array> $jsInline = []

$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 $languageDependencies = []

$metaCharsetTag

protected string $metaCharsetTag = '<meta http-equiv="Content-Type" content="text/html; charset=|" />'

$moveJsFromHeaderToFooter

protected bool $moveJsFromHeaderToFooter = false

$publicRequireJsConfig

Inline configuration for requireJS (public)

protected array $publicRequireJsConfig = []

$removeLineBreaksFromTemplate

protected bool $removeLineBreaksFromTemplate = false

$renderXhtml

protected bool $renderXhtml = true

$requireJsConfig

Inline configuration for requireJS (internal)

protected array $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 $array) : mixed

Parameters

$array : array

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 $array) : mixed

Parameters

$namespace : string
$array : array

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 $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

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

string

getBaseUrl()

Gets HTML base URL

public getBaseUrl() : string

Return values

string —

$url

getBodyContent()

Gets content for body

public getBodyContent() : string

Return values

string

getCharSet()

Gets the charSet

public getCharSet() : string

Return values

string —

$charSet

getCompressCss()

Gets compress of css

public getCompressCss() : bool

Return values

bool

getCompressJavascript()

Gets compress of javascript

public getCompressJavascript() : bool

Return values

bool

getConcatenateCss()

Gets concatenate of css files

public getConcatenateCss() : bool

Return values

bool

getConcatenateJavascript()

Gets concatenate of js files

public getConcatenateJavascript() : bool

Return values

bool

getFavIcon()

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

Return values

array

getInlineLanguageLabels()

Gets the inline language labels.

public getInlineLanguageLabels() : array

Return values

array —

The inline language labels

getLanguage()

Gets the language

public getLanguage() : string

Return values

string —

$lang

getMetaCharsetTag()

Get meta charset

public getMetaCharsetTag() : string

Return values

string

getMetaTag()

Returns the requested meta tag

public getMetaTag(string $type, string $name) : array

Parameters

$type : string
$name : string

Return values

array

getMoveJsFromHeaderToFooter()

Gets MoveJsFromHeaderToFooter

public getMoveJsFromHeaderToFooter() : bool

Return values

bool

getRemoveLineBreaksFromTemplate()

Gets remove of empty lines from template

public getRemoveLineBreaksFromTemplate() : bool

Return values

bool

getRenderXhtml()

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

Parameters

$scope : string|null = null

Return values

array

getState()

public getState() : array

Return values

array

getTemplateFile()

Gets template file

public getTemplateFile() : string

Return values

string

getTitle()

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

string

renderPageWithUncachedObjects()

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

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 $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 = []

Subproperties of the meta tag (like e.g. og:image:width)

$replace : bool = true

Replace earlier set meta tag

Tags

throws
InvalidArgumentException

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 $newState) : void

Parameters

$newState : array

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

Parameters

$isDevelopment : bool
$packages : array<string, PackageInterface>

Return values

array —

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 $properties) : string

Parameters

$file : string

the filename to process

$properties : array

Return values

string

doCompress()

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 $array, string[] $keys[, bool $keep = true ]) : array

Parameters

$array : array
$keys : string[]
$keep : bool = true

Return values

array

findRequireJsBaseModuleName()

Determines requireJS base module name (if defined).

protected findRequireJsBaseModuleName(string $moduleName) : string|null

Parameters

$moduleName : string

Return values

string|null

getAbsoluteWebPath()

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

see
TypoScriptFrontendController::setAbsRefPrefix()

Return values

string

getPreparedMarkerArray()

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

Parameters

$jsLibs : string
$jsFiles : string
$jsFooterFiles : string
$cssLibs : string
$cssFiles : string
$jsInline : string
$cssInline : string
$jsFooterInline : string
$jsFooterLibs : string
$metaTags : string

Return values

array —

Marker array

getPreparedMarkerArrayForPageWithUncachedObjects()

Fills the marker array with the given strings and trims each value

protected getPreparedMarkerArrayForPageWithUncachedObjects(string $substituteHash) : array

Parameters

$substituteHash : string

The hash that is used for the placeholder markers

Return values

array —

Marker array

getRequireJsLoader()

Generates RequireJS loader HTML markup.

protected getRequireJsLoader() : string

Tags

throws
RouteNotFoundException

Return values

string

getStreamlinedFileName()

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

string

getTemplate()

Reads the template file and returns the requested part as string

protected getTemplate() : string

Return values

string

includeLanguageFileForInline()

Include language file for inline usage

protected includeLanguageFileForInline(string $fileRef[, string $selectionPrefix = '' ][, string $stripFromSelectionName = '' ]) : mixed

Parameters

$fileRef : string
$selectionPrefix : string = ''
$stripFromSelectionName : string = ''

Tags

throws
RuntimeException

loadJavaScriptLanguageStrings()

Load the language strings into JavaScript

protected loadJavaScriptLanguageStrings() : mixed

parseLanguageLabelsForJavaScript()

Converts the language labels for usage in JavaScript

protected parseLanguageLabelsForJavaScript() : array

Return values

array

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

Parameters

$fileRef : string

Reference to a relative filename to include.

Return values

array —

Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.

renderAdditionalJavaScriptLibraries()

Render JavaScript libraries

protected renderAdditionalJavaScriptLibraries() : array|string[]

Return values

array|string[] —

jsLibs and jsFooterLibs strings

renderCssFiles()

Render CSS files

protected renderCssFiles() : string

Return values

string

renderCssInline()

Render inline CSS

protected renderCssInline() : string

Return values

string

renderCssLibraries()

Render CSS library files

protected renderCssLibraries() : string

Return values

string

renderInlineJavaScript()

Render inline JavaScript

protected renderInlineJavaScript() : array|string[]

Return values

array|string[] —

jsInline and jsFooterInline string

renderJavaScriptAndCss()

Renders all JavaScript and CSS

protected renderJavaScriptAndCss() : array|string[]

Return values

array|string[]

renderJavaScriptFiles()

Render JavaScript files

protected renderJavaScriptFiles() : array|string[]

Return values

array|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

Return values

array

reset()

Reset all vars to initial values

protected reset() : mixed
On this page