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 been set up the PSR-7 ServerRequest object and the following things have been evaluated
- correct page ID, page type (typeNum), rootline, MP etc.
- info if is cached content already available
- proper language
- proper TypoScript which should be processed.
Then, this class is able to render the actual HTTP body part built via TypoScript. Here this is split into two parts:
- Everything included in , done via page.10, page.20 etc.
- Everything around.
If the content has been built together within the cache (cache_pages), it is fetched directly, and any so-called "uncached" content is generated again.
Some further events allow to post-process the content.
Then the right HTTP response headers are compiled together and sent as well.
Table of Contents
Interfaces
- RequestHandlerInterface
Methods
- __construct() : mixed
- handle() : ResponseInterface
- Handles a frontend request, after finishing running middlewares
- addCssToPageRenderer() : void
- Adds inline CSS code, by respecting the inlineStyle2TempFile option
- displayPreviewInfoMessage() : mixed
- 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.
- getLanguageService() : LanguageService
- getPageRenderer() : PageRenderer
- 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.
- resetGlobalsToCurrentRequest() : mixed
- Sets the global GET and POST to the values, so if people access $_GET and $_POST Within hooks starting NOW (e.g. cObject), they get the "enriched" data from query params.
- stripIntObjectPlaceholder() : mixed
- Searches for placeholder created from *_INT cObjects, removes them from $searchString and merges them to $intObjects
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, ListenerProvider $listenerProvider, TimeTracker $timeTracker, FilePathSanitizer $filePathSanitizer, TypoScriptService $typoScriptService, Context $context) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $listenerProvider : ListenerProvider
- $timeTracker : TimeTracker
- $filePathSanitizer : FilePathSanitizer
- $typoScriptService : TypoScriptService
- $context : Context
handle()
Handles a frontend request, after finishing running middlewares
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, bool $excludeFromConcatenation, string $inlineBlockName) : void
Parameters
- $request : ServerRequestInterface
- $cssStyles : string
-
the inline CSS styling
- $excludeFromConcatenation : bool
-
option to see if it should be concatenated
- $inlineBlockName : string
-
the block name to add it
displayPreviewInfoMessage()
Include the preview block in case we're looking at a hidden page in the LIVE workspace
protected
displayPreviewInfoMessage(ServerRequestInterface $request, TypoScriptFrontendController $controller) : mixed
Parameters
- $request : ServerRequestInterface
- $controller : TypoScriptFrontendController
this method might get moved to a PSR-15 middleware at some point
generateHrefLangTags()
protected
generateHrefLangTags(TypoScriptFrontendController $controller, ServerRequestInterface $request) : void
Parameters
- $controller : TypoScriptFrontendController
- $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(TypoScriptFrontendController $controller, ServerRequestInterface $request) : string
Parameters
- $controller : TypoScriptFrontendController
- $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(TypoScriptFrontendController $controller, ServerRequestInterface $request) : string
Parameters
- $controller : TypoScriptFrontendController
- $request : ServerRequestInterface
Return values
stringgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetPageRenderer()
protected
getPageRenderer() : PageRenderer
Return values
PageRendererprocessHtmlBasedRenderingSettings()
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(TypoScriptFrontendController $controller, 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
- $controller : TypoScriptFrontendController
- $request : ServerRequestInterface
resetGlobalsToCurrentRequest()
Sets the global GET and POST to the values, so if people access $_GET and $_POST Within hooks starting NOW (e.g. cObject), they get the "enriched" data from query params.
protected
resetGlobalsToCurrentRequest(ServerRequestInterface $request) : mixed
This needs to be run after the request object has been enriched with modified GET/POST variables.
Parameters
- $request : ServerRequestInterface
this safety net will be removed in TYPO3 v10.0.
stripIntObjectPlaceholder()
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)