RequestHandler implements RequestHandlerInterface
This is the main entry point of the TypoScript driven standard front-end.
"handle()" is called when all PSR-15 middlewares have set up the PSR-7 ServerRequest.
Then, this class creates the Response with main body content using the ContentObjectRenderer based on TypoScript configuration and to add main HTTP headers.
Table of Contents
Interfaces
- RequestHandlerInterface
Methods
- __construct() : mixed
- handle() : ResponseInterface
- Handle frontend request after middlewares finished to create a response.
- addCssToPageRenderer() : void
- Adds inline CSS code, by respecting the inlineStyle2TempFile option
- addHttpHeadersToResponse() : ResponseInterface
- calculateNonCachedElements() : string
- Calculate non cached elements and inline to given cacheable content.
- displayPreviewInfoMessage() : string
- Include the preview block in case we're looking at a hidden page in the LIVE workspace
- generateHrefLangTags() : void
- generateHtmlTag() : string
- Generates the <html> tag by evaluating TypoScript configuration, usually found via:
- generateMetaTagHtml() : mixed
- Generate meta tags from meta tag TypoScript
- generatePageBodyContent() : string
- Generates the main content part within <body> tags (except JS files/CSS files), this means: render everything that can be cached, otherwise put placeholders for COA_INT/USER_INT objects in the content that is processed later-on.
- generatePageContent() : string
- Generates the main body part for the page, and if "config.disableAllHeaderCode" is not active, triggers pageRenderer to evaluate includeCSS, headTag etc. TypoScript processing to populate the pageRenderer.
- generatePageTitle() : string
- Create and return page title. This ends up as HTML <head> <title> tag.
- getAdditionalHeadersFromTypoScript() : array<string|int, mixed>
- Determine additional headers from TypoScript config.additionalHeaders
- getClientCacheHeaders() : array<string|int, mixed>
- getLanguageService() : LanguageService
- processHtmlBasedRenderingSettings() : void
- At this point, the cacheable content has just been generated: Content is available but hasn't been added to PageRenderer yet. The method is called after the "main" page content, since some JS may be inserted at that point that has been registered by cacheable plugins.
- processNonCacheableContentPartsAndSubstituteContentMarkers() : string
- Splits content by <!--INT_SCRIPT.12345 --> and puts the content back together with content from processed content elements.
- recursivelyReplaceIntPlaceholdersInContent() : string
- Replace non-cached element placeholders ("INT" placeholders) in content. In case the replacement adds additional placeholders, it loops until no new placeholders are found.
- stripIntObjectPlaceholder() : mixed
- Searches for placeholder created from *_INT cObjects, removes them from $searchString and merges them to $intObjects
- updateSysLastChangedInPageRecord() : void
- Setting the SYS_LASTCHANGED value in the page record: This value is set to the highest timestamp of records rendered on the page. This includes all records with no regard to hidden records, user protection and so on. This updates a translated "pages" record (_LOCALIZED_UID) if the Frontend is called with a translation.
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, ListenerProvider $listenerProvider, TimeTracker $timeTracker, SystemResourceFactory $systemResourceFactory, SystemResourcePublisherInterface $resourcePublisher, TypoScriptService $typoScriptService, Context $context, ResponseService $responseService, PolicyProvider $policyProvider, PageRenderer $pageRenderer, FrontendInterface $pageCache, ConnectionPool $connectionPool, CacheLifetimeCalculator $cacheLifetimeCalculator) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $listenerProvider : ListenerProvider
- $timeTracker : TimeTracker
- $systemResourceFactory : SystemResourceFactory
- $resourcePublisher : SystemResourcePublisherInterface
- $typoScriptService : TypoScriptService
- $context : Context
- $responseService : ResponseService
- $policyProvider : PolicyProvider
- $pageRenderer : PageRenderer
- $pageCache : FrontendInterface
- $connectionPool : ConnectionPool
- $cacheLifetimeCalculator : CacheLifetimeCalculator
handle()
Handle frontend request after middlewares finished to create a response.
public
handle(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfaceaddCssToPageRenderer()
Adds inline CSS code, by respecting the inlineStyle2TempFile option
protected
addCssToPageRenderer(ServerRequestInterface $request, string $cssStyles, string $inlineBlockName) : void
Parameters
- $request : ServerRequestInterface
- $cssStyles : string
-
the inline CSS styling
- $inlineBlockName : string
-
the block name to add it
addHttpHeadersToResponse()
protected
addHttpHeadersToResponse(ServerRequestInterface $request, ResponseInterface $response, string $content) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $content : string
Return values
ResponseInterfacecalculateNonCachedElements()
Calculate non cached elements and inline to given cacheable content.
protected
calculateNonCachedElements(ServerRequestInterface $request, string $content) : string
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringdisplayPreviewInfoMessage()
Include the preview block in case we're looking at a hidden page in the LIVE workspace
protected
displayPreviewInfoMessage(ServerRequestInterface $request, string $content) : string
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringgenerateHrefLangTags()
protected
generateHrefLangTags(ServerRequestInterface $request) : void
Parameters
- $request : ServerRequestInterface
generateHtmlTag()
Generates the <html> tag by evaluating TypoScript configuration, usually found via:
protected
generateHtmlTag(array<string|int, mixed> $htmlTagAttributes, array<string|int, mixed> $configuration, ContentObjectRenderer $cObj) : string
-
Adding extra attributes in addition to pre-generated ones (e.g. "dir") config.htmlTag.attributes.no-js = 1 config.htmlTag.attributes.empty-attribute =
-
Adding one full string (no stdWrap!) to the "<html $htmlTagAttributes {config.htmlTag_setParams}>" tag config.htmlTag_setParams = string|"none"
If config.htmlTag_setParams = none is set, even the pre-generated values are not added at all anymore.
-
"config.htmlTag_stdWrap" always applies over the whole compiled tag.
Parameters
- $htmlTagAttributes : array<string|int, mixed>
-
pre-generated attributes by doctype/direction etc. values.
- $configuration : array<string|int, mixed>
-
the TypoScript configuration "config." array
- $cObj : ContentObjectRenderer
Return values
string —the full tag as string
generateMetaTagHtml()
Generate meta tags from meta tag TypoScript
protected
generateMetaTagHtml(array<string|int, mixed> $metaTagTypoScript, ContentObjectRenderer $cObj) : mixed
Parameters
- $metaTagTypoScript : array<string|int, mixed>
-
TypoScript configuration for meta tags
- $cObj : ContentObjectRenderer
generatePageBodyContent()
Generates the main content part within <body> tags (except JS files/CSS files), this means: render everything that can be cached, otherwise put placeholders for COA_INT/USER_INT objects in the content that is processed later-on.
protected
generatePageBodyContent(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringgeneratePageContent()
Generates the main body part for the page, and if "config.disableAllHeaderCode" is not active, triggers pageRenderer to evaluate includeCSS, headTag etc. TypoScript processing to populate the pageRenderer.
protected
generatePageContent(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringgeneratePageTitle()
Create and return page title. This ends up as HTML <head> <title> tag.
protected
generatePageTitle(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Tags
Return values
stringgetAdditionalHeadersFromTypoScript()
Determine additional headers from TypoScript config.additionalHeaders
protected
getAdditionalHeadersFromTypoScript(ServerRequestInterface $request) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
Return values
array<string|int, mixed>getClientCacheHeaders()
protected
getClientCacheHeaders(ServerRequestInterface $request, string $content) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
array<string|int, mixed>getLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServiceprocessHtmlBasedRenderingSettings()
At this point, the cacheable content has just been generated: Content is available but hasn't been added to PageRenderer yet. The method is called after the "main" page content, since some JS may be inserted at that point that has been registered by cacheable plugins.
protected
processHtmlBasedRenderingSettings(ServerRequestInterface $request) : void
PageRenderer is now populated with all
data and additional JavaScript/CSS/FooterData/HeaderData that can be cached. Once finished, the content is added to the >addBodyContent() functionality.Parameters
- $request : ServerRequestInterface
processNonCacheableContentPartsAndSubstituteContentMarkers()
Splits content by <!--INT_SCRIPT.12345 --> and puts the content back together with content from processed content elements.
protected
processNonCacheableContentPartsAndSubstituteContentMarkers(array<string|int, mixed> $nonCacheableData, ServerRequestInterface $request, string $incomingContent) : string
Parameters
- $nonCacheableData : array<string|int, mixed>
- $request : ServerRequestInterface
- $incomingContent : string
Return values
stringrecursivelyReplaceIntPlaceholdersInContent()
Replace non-cached element placeholders ("INT" placeholders) in content. In case the replacement adds additional placeholders, it loops until no new placeholders are found.
protected
recursivelyReplaceIntPlaceholdersInContent(ServerRequestInterface $request, string $content) : string
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringstripIntObjectPlaceholder()
Searches for placeholder created from *_INT cObjects, removes them from $searchString and merges them to $intObjects
protected
stripIntObjectPlaceholder(string &$searchString, string &$intObjects) : mixed
Parameters
- $searchString : string
-
The String which should be cleaned from int-object markers
- $intObjects : string
-
The String the found int-placeholders are moved to (for further processing)
updateSysLastChangedInPageRecord()
Setting the SYS_LASTCHANGED value in the page record: This value is set to the highest timestamp of records rendered on the page. This includes all records with no regard to hidden records, user protection and so on. This updates a translated "pages" record (_LOCALIZED_UID) if the Frontend is called with a translation.
protected
updateSysLastChangedInPageRecord(ServerRequestInterface $request) : void
Parameters
- $request : ServerRequestInterface