PageRenderer implements SingletonInterface

TYPO3 pageRender class This class render the HTML of a webpage, usable for BE and FE

Tags
todo

mark this class final in TYPO3 v13.0

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
$applyNonceHint  : bool
$assetRenderer  : AssetRenderer
$assetsCache  : FrontendInterface
$baseUrl  : string
$baseUrlTag  : string
$bodyContent  : string
$charSet  : string
Charset for the rendering
$compressCss  : bool
$compressJavascript  : bool
$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>>
$docType  : DocType
$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'
$languageServiceFactory  : LanguageServiceFactory
$locale  : Locale
The locale, used for the <html> tag (depending on the DocType) and possible translation files.
$metaCharsetTag  : string
$metaTagRegistry  : MetaTagManagerRegistry
$metaTags  : array<string|int, mixed>
$moveJsFromHeaderToFooter  : bool
$nonce  : ConsumableNonce|null
$packageManager  : PackageManager
$publicRequireJsConfig  : array<string|int, mixed>
Inline configuration for requireJS (public)
$relativeCssPathFixer  : RelativeCssPathFixer
$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
$resourceCompressor  : ResourceCompressor
$responseFactory  : ResponseFactoryInterface
$shortcutTag  : string
$streamFactory  : StreamFactoryInterface
$templateFile  : string
$templateService  : MarkerBasedTemplateService
$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
getDocType()  : DocType
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
loadJavaScriptModule()  : mixed
Includes an ES6/ES11 compatible JavaScript module by resolving the specifier to an import-mapped filename.
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
renderResponse()  : ResponseInterface
setApplyNonceHint()  : void
setBaseUrl()  : mixed
Sets HTML base URL
setBodyContent()  : mixed
Sets Content for Body
setCharSet()  : mixed
Sets meta charset
setDocType()  : void
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
setNonce()  : void
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.
addGlobalCSSUrlsToInlineSettings()  : mixed
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. Only possible in TYPO3 Frontend.
doCompressJavaScript()  : mixed
Compresses JavaScript according to configuration. Only possible in TYPO3 Frontend.
doConcatenate()  : mixed
Concatenate files into one file registered handler
doConcatenateCss()  : mixed
Concatenate CSS files according to configuration. Only possible in TYPO3 Frontend.
doConcatenateJavaScript()  : mixed
Concatenate JavaScript files according to the configuration. Only possible in TYPO3 Frontend.
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.
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 (must not apply `nonce="..."` if defined).
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()  : void
Reset all vars to initial values
setDefaultHtmlTag()  : void
Internal method to set a basic <html> tag when in HTML5 with the proper language/locale and "dir" attributes.
wrapInlineScript()  : string
wrapInlineStyle()  : string

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<string|int, mixed> $additionalRequireJsConfig = []

$addRequireJs

if set, the requireJS library is included

protected bool $addRequireJs = false

$applyNonceHint

protected bool $applyNonceHint = false

$baseUrl

Deprecated

will be removed in TYPO3 v13.0.

protected string $baseUrl

$baseUrlTag

Deprecated

will be removed in TYPO3 v13.0.

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

$charSet

Charset for the rendering

protected string $charSet = 'utf-8'

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

$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

Deprecated

since TYPO3 v12.4, will be removed in TYPO3 v13.0 - use method wrapInlineStyle instead

protected array<string|int, mixed> $inlineCssWrap = ['<style>' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF, '-->' . LF . '/*]]>*/' . LF . '</style>' . LF]

$inlineJavascriptWrap

Deprecated

since TYPO3 v12.4, will be removed in TYPO3 v13.0 - use method wrapInlineScript instead

protected array{0: string, 1: string} $inlineJavascriptWrap = ['<script>' . 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 = []

$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

$locale

The locale, used for the <html> tag (depending on the DocType) and possible translation files.

protected Locale $locale

$metaCharsetTag

Deprecated

will be removed in TYPO3 v13.0

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

$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

Deprecated

since TYPO3 v12.2. will be removed in TYPO3 v13.0 along with enable, disable and getter method.

protected bool $removeLineBreaksFromTemplate = false

$renderXhtml

Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

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/'

$responseFactory read-only

protected ResponseFactoryInterface $responseFactory

$shortcutTag

protected string $shortcutTag = '<link rel="icon" href="%1$s"%2$s />'

$streamFactory read-only

protected StreamFactoryInterface $streamFactory

$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(FrontendInterface $assetsCache, MarkerBasedTemplateService $templateService, MetaTagManagerRegistry $metaTagRegistry, PackageManager $packageManager, AssetRenderer $assetRenderer, ResourceCompressor $resourceCompressor, RelativeCssPathFixer $relativeCssPathFixer, LanguageServiceFactory $languageServiceFactory, ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory) : mixed
Parameters
$assetsCache : FrontendInterface
$templateService : MarkerBasedTemplateService
$metaTagRegistry : MetaTagManagerRegistry
$packageManager : PackageManager
$assetRenderer : AssetRenderer
$resourceCompressor : ResourceCompressor
$relativeCssPathFixer : RelativeCssPathFixer
$languageServiceFactory : LanguageServiceFactory
$responseFactory : ResponseFactoryInterface
$streamFactory : StreamFactoryInterface

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 ][, array<string, string> $tagAttributes = [] ]) : 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
$tagAttributes : array<string, string> = []

Key => value list of tag attributes

addCssInlineBlock()

Adds CSS inline code

public addCssInlineBlock(string $name, string $block[, bool $compress = false ][, bool $forceOnTop = false ][, bool $useNonce = false ]) : mixed
Parameters
$name : string
$block : string
$compress : bool = false
$forceOnTop : bool = false
$useNonce : 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 ][, array<string, string> $tagAttributes = [] ]) : 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
$tagAttributes : array<string, string> = []

Key => value list of tag attributes

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|null $type = '' ][, 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 ][, array<string, string> $tagAttributes = [] ]) : mixed
Parameters
$file : string

File name

$type : string|null = ''

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

$tagAttributes : array<string, string> = []

Key => value list of tag attributes

addJsFooterFile()

Adds JS file to footer

public addJsFooterFile(string $file[, string|null $type = '' ][, 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 ][, array<string, string> $tagAttributes = [] ]) : mixed
Parameters
$file : string

File name

$type : string|null = ''

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

$tagAttributes : array<string, string> = []

Key => value list of tag attributes

addJsFooterInlineCode()

Adds JS inline code to footer

public addJsFooterInlineCode(string $name, string $block[, bool $compress = true ][, bool $forceOnTop = false ][, bool $useNonce = false ]) : mixed
Parameters
$name : string
$block : string
$compress : bool = true
$forceOnTop : bool = false
$useNonce : 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|null $type = '' ][, 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 ][, array<string, string> $tagAttributes = [] ]) : mixed
Parameters
$name : string

Arbitrary identifier

$file : string

File name

$type : string|null = ''

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

$tagAttributes : array<string, string> = []

Key => value list of tag attributes

addJsInlineCode()

Adds JS inline code

public addJsInlineCode(string $name, string $block[, bool $compress = true ][, bool $forceOnTop = false ][, bool $useNonce = false ]) : mixed
Parameters
$name : string
$block : string
$compress : bool = true
$forceOnTop : bool = false
$useNonce : bool = false

addJsLibrary()

Adds JS Library. JS Library block is rendered on top of the JS files.

public addJsLibrary(string $name, string $file[, string|null $type = '' ][, 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 ][, array<string, string> $tagAttributes = [] ]) : mixed
Parameters
$name : string

Arbitrary identifier

$file : string

File name

$type : string|null = ''

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

$tagAttributes : array<string, string> = []

Key => value list of tag attributes

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
Deprecated

since TYPO3 v12.2. will be removed in TYPO3 v13.0.

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
Deprecated

since TYPO3 v12.3. Will be removed in TYPO3 v13.0

enableMoveJsFromHeaderToFooter()

Enables MoveJsFromHeaderToFooter

public enableMoveJsFromHeaderToFooter() : mixed

enableRemoveLineBreaksFromTemplate()

Sets removal of all line breaks in template

public enableRemoveLineBreaksFromTemplate() : mixed
Deprecated

since TYPO3 v12.2. will be removed in TYPO3 v13.0.

getApplicationType()

String 'FE' if in FrontendApplication, 'BE' otherwise (also in CLI without request object)

public getApplicationType() : string
Internal
Return values
string

getBaseUrl()

Gets HTML base URL

public getBaseUrl() : string
Deprecated

will be removed in TYPO3 v13.0.

Return values
string

$url

getBodyContent()

Gets content for body

public getBodyContent() : string
Return values
string

getCharSet()

Gets the charSet

public getCharSet() : string
Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

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

getLanguage()

Gets the language

public getLanguage() : string
Return values
string

$lang

getMetaCharsetTag()

Get meta charset

public getMetaCharsetTag() : string
Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

Return values
string

getMetaTag()

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
bool

getRemoveLineBreaksFromTemplate()

Gets remove of empty lines from template

public getRemoveLineBreaksFromTemplate() : bool
Deprecated

since TYPO3 v12.2. will be removed in TYPO3 v13.0.

Return values
bool

getRenderXhtml()

Returns rendering mode XHTML or HTML

public getRenderXhtml() : bool
Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

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>
Internal
Return values
array<string|int, mixed>

getTemplateFile()

Gets template file

public getTemplateFile() : string
Return values
string

getTitle()

Gets the title

public getTitle() : string
Return values
string

$title Title of webpage

loadJavaScriptModule()

Includes an ES6/ES11 compatible JavaScript module by resolving the specifier to an import-mapped filename.

public loadJavaScriptModule(string $specifier) : mixed
Parameters
$specifier : string

Bare module identifier like @my/package/Filename.js

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 ][, bool $internal = false ]) : mixed
Deprecated

will be removed in TYPO3 v13.0. Use loadJavaScriptModule() instead, available since TYPO3 v12.0.

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() }

$internal : bool = false

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

Internal
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

Internal
Return values
string

Content of rendered page

renderResponse()

public renderResponse([int $code = 200 ][, string $reasonPhrase = '' ]) : ResponseInterface
Parameters
$code : int = 200
$reasonPhrase : string = ''
Return values
ResponseInterface

setApplyNonceHint()

public setApplyNonceHint(bool $applyNonceHint) : void
Parameters
$applyNonceHint : bool

setBaseUrl()

Sets HTML base URL

public setBaseUrl(string $baseUrl[, bool $isInternalCall = false ]) : mixed
Deprecated

will be removed in TYPO3 v13.0 - tags are not supported anymore in TYPO3.

Parameters
$baseUrl : string

HTML base URL

$isInternalCall : bool = false

only to be used by TYPO3 Core to avoid multiple deprecations.

setBodyContent()

Sets Content for Body

public setBodyContent(string $content) : mixed
Parameters
$content : string

setCharSet()

Sets meta charset

public setCharSet(string $charSet) : mixed
Deprecated

will be removed in TYPO3 v13.0

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|Locale $lang) : mixed
Parameters
$lang : string|Locale

Used language

setMetaCharsetTag()

Set the meta charset tag

public setMetaCharsetTag(string $metaCharsetTag) : mixed
Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

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
throws
InvalidArgumentException

setRenderXhtml()

Enables/disables rendering of XHTML code

public setRenderXhtml(bool $enable) : mixed
Deprecated

will be removed in TYPO3 v13.0. Use DocType instead.

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> $state) : void
Parameters
$state : array<string|int, mixed>
Internal

addAjaxUrlsToInlineSettings()

Make URLs to all backend ajax handlers available as inline setting.

protected addAjaxUrlsToInlineSettings([bool $publicRoutesOnly = false ]) : mixed
Parameters
$publicRoutesOnly : bool = false

addGlobalCSSUrlsToInlineSettings()

protected addGlobalCSSUrlsToInlineSettings() : mixed

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
string

doCompress()

Compresses inline code

protected doCompress() : mixed

doCompressCss()

Compresses CSS according to configuration. Only possible in TYPO3 Frontend.

protected doCompressCss() : mixed

doCompressJavaScript()

Compresses JavaScript according to configuration. Only possible in TYPO3 Frontend.

protected doCompressJavaScript() : mixed

doConcatenate()

Concatenate files into one file registered handler

protected doConcatenate() : mixed

doConcatenateCss()

Concatenate CSS files according to configuration. Only possible in TYPO3 Frontend.

protected doConcatenateCss() : mixed

doConcatenateJavaScript()

Concatenate JavaScript files according to the configuration. Only possible in TYPO3 Frontend.

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

Internal
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 = ''

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
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 (must not apply `nonce="..."` if defined).

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() : void

setDefaultHtmlTag()

Internal method to set a basic <html> tag when in HTML5 with the proper language/locale and "dir" attributes.

protected setDefaultHtmlTag() : void

wrapInlineScript()

protected wrapInlineScript(string $content[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$content : string
$attributes : array<string|int, mixed> = []
Return values
string

wrapInlineStyle()

protected wrapInlineStyle(string $content[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$content : string
$attributes : array<string|int, mixed> = []
Return values
string

        
On this page

Search results