ModuleTemplate implements ViewInterface, ResponsableViewInterface uses PageRendererBackendSetupTrait
A class taking care of the "outer" HTML of a module, especially the doc header and other related parts.
Table of Contents
Interfaces
- ViewInterface
- A generic view interface.
- ResponsableViewInterface
- An optional addition to ViewInterface that allows getting a PSR-7 Response directly.
Properties
- $bodyTag : string
- $docHeaderComponent : DocHeaderComponent
- $extensionConfiguration : ExtensionConfiguration
- $flashMessageQueue : FlashMessageQueue
- $flashMessageService : FlashMessageService
- $formTag : string
- $iconFactory : IconFactory
- $moduleClass : string
- $moduleId : string
- $moduleName : string
- $moduleProvider : ModuleProvider
- $pageRenderer : PageRenderer
- $request : ServerRequestInterface
- $title : string
- $uiBlock : bool
- $uriBuilder : UriBuilder
- $view : ViewInterface
Methods
- __construct() : mixed
- Init PageRenderer and properties.
- addFlashMessage() : self
- Creates a message object and adds it to the FlashMessageQueue.
- assign() : self
- Add a variable to the view data collection.
- assignMultiple() : self
- Add multiple variables to the view data collection.
- getDocHeaderComponent() : DocHeaderComponent
- Get the DocHeader. Can be used in controllers to add custom buttons / menus / ... to the doc header.
- makeDocHeaderModuleMenu() : self
- Generates a menu in the docheader to access third-level modules
- render() : string
- Render the module.
- renderResponse() : ResponseInterface
- Render the module and create an HTML 200 response from it. This is a lazy shortcut so controllers don't need to take care of this in the backend.
- setBodyTag() : self
- Set to something like '<body id="foo">' when a special body tag is needed.
- setFlashMessageQueue() : self
- ModuleTemplate by default uses queue 'core.template.flashMessages'. Modules may want to maintain an own queue. Use this method to render flash messages of a non-default queue at the default position in module HTML output. Call this method *before* adding single messages with addFlashMessage().
- setForm() : self
- A "<form>" tag encapsulating the entire module, including doc-header.
- setModuleClass() : self
- Optional 'class="module {moduleClass}"' on first <div> in body.
- setModuleId() : self
- Optional 'data-module-id="{moduleId}"' on first <div> in body.
- setModuleName() : self
- Optional 'data-module-name="{moduleName}"' on first <div> in body.
- setTitle() : self
- Title string of the module: "My module · Edit view"
- setUiBlock() : self
- UI block is a spinner shown during browser rendering phase of the module, automatically removed when rendering finished. This is done by default, but the UI block can be turned off when needed for whatever reason.
- dispatchNotificationMessages() : void
- Dispatches all messages in a special FlashMessageQueue to the PageRenderer to be rendered as inline notifications
- getBackendFavicon() : string
- Retrieves configured favicon for backend with fallback.
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService
- getNormalizedParams() : NormalizedParams
- getUriForFileName() : string
- Returns the uri of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the project root of the TYPO3 installation
- loadStylesheets() : void
- Load all registered stylesheets from $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']
- prepareRender() : void
- setUpBasicPageRendererForBackend() : void
- Sets mandatory parameters for the PageRenderer.
Properties
$bodyTag
protected
string
$bodyTag
= '<body>'
$docHeaderComponent
protected
DocHeaderComponent
$docHeaderComponent
$extensionConfiguration read-only
protected
ExtensionConfiguration
$extensionConfiguration
$flashMessageQueue
protected
FlashMessageQueue
$flashMessageQueue
$flashMessageService read-only
protected
FlashMessageService
$flashMessageService
$formTag
protected
string
$formTag
= ''
$iconFactory read-only
protected
IconFactory
$iconFactory
$moduleClass
protected
string
$moduleClass
= ''
$moduleId
protected
string
$moduleId
= ''
$moduleName
protected
string
$moduleName
= ''
$moduleProvider read-only
protected
ModuleProvider
$moduleProvider
$pageRenderer read-only
protected
PageRenderer
$pageRenderer
$request read-only
protected
ServerRequestInterface
$request
$title
protected
string
$title
= ''
$uiBlock
protected
bool
$uiBlock
= false
$uriBuilder read-only
protected
UriBuilder
$uriBuilder
$view read-only
protected
ViewInterface
$view
Methods
__construct()
Init PageRenderer and properties.
public
__construct(PageRenderer $pageRenderer, IconFactory $iconFactory, UriBuilder $uriBuilder, ModuleProvider $moduleProvider, FlashMessageService $flashMessageService, ExtensionConfiguration $extensionConfiguration, ViewInterface $view, ServerRequestInterface $request) : mixed
Parameters
- $pageRenderer : PageRenderer
- $iconFactory : IconFactory
- $uriBuilder : UriBuilder
- $moduleProvider : ModuleProvider
- $flashMessageService : FlashMessageService
- $extensionConfiguration : ExtensionConfiguration
- $view : ViewInterface
- $request : ServerRequestInterface
addFlashMessage()
Creates a message object and adds it to the FlashMessageQueue.
public
addFlashMessage(string $messageBody[, string $messageTitle = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = true ]) : self
These messages are automatically rendered when the view is rendered.
Parameters
- $messageBody : string
- $messageTitle : string = ''
- $severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
- $storeInSession : bool = true
Return values
selfassign()
Add a variable to the view data collection.
public
assign(string $key, mixed $value) : self
Parameters
- $key : string
- $value : mixed
Return values
selfassignMultiple()
Add multiple variables to the view data collection.
public
assignMultiple(array<string|int, mixed> $values) : self
Parameters
- $values : array<string|int, mixed>
-
Array of string keys with mixed-type values.
Return values
selfgetDocHeaderComponent()
Get the DocHeader. Can be used in controllers to add custom buttons / menus / ... to the doc header.
public
getDocHeaderComponent() : DocHeaderComponent
Return values
DocHeaderComponentmakeDocHeaderModuleMenu()
Generates a menu in the docheader to access third-level modules
public
makeDocHeaderModuleMenu([array<string|int, mixed> $additionalQueryParams = [] ]) : self
Parameters
- $additionalQueryParams : array<string|int, mixed> = []
Return values
selfrender()
Render the module.
public
render([string $templateFileName = '' ]) : string
Parameters
- $templateFileName : string = ''
Return values
stringrenderResponse()
Render the module and create an HTML 200 response from it. This is a lazy shortcut so controllers don't need to take care of this in the backend.
public
renderResponse([string $templateFileName = '' ]) : ResponseInterface
Parameters
- $templateFileName : string = ''
Return values
ResponseInterfacesetBodyTag()
Set to something like '<body id="foo">' when a special body tag is needed.
public
setBodyTag(string $bodyTag) : self
Parameters
- $bodyTag : string
Return values
selfsetFlashMessageQueue()
ModuleTemplate by default uses queue 'core.template.flashMessages'. Modules may want to maintain an own queue. Use this method to render flash messages of a non-default queue at the default position in module HTML output. Call this method *before* adding single messages with addFlashMessage().
public
setFlashMessageQueue(FlashMessageQueue $flashMessageQueue) : self
Parameters
- $flashMessageQueue : FlashMessageQueue
Return values
selfsetForm()
A "<form>" tag encapsulating the entire module, including doc-header.
public
setForm([string $formTag = '' ]) : self
Parameters
- $formTag : string = ''
Return values
selfsetModuleClass()
Optional 'class="module {moduleClass}"' on first <div> in body.
public
setModuleClass(string $moduleClass) : self
Can be helpful styling modules.
Parameters
- $moduleClass : string
Return values
selfsetModuleId()
Optional 'data-module-id="{moduleId}"' on first <div> in body.
public
setModuleId(string $moduleId) : self
Can be helpful in JavaScript.
Parameters
- $moduleId : string
Return values
selfsetModuleName()
Optional 'data-module-name="{moduleName}"' on first <div> in body.
public
setModuleName(string $moduleName) : self
Can be helpful in JavaScript.
Parameters
- $moduleName : string
Return values
selfsetTitle()
Title string of the module: "My module · Edit view"
public
setTitle(string $title[, string $context = '' ]) : self
Parameters
- $title : string
- $context : string = ''
Return values
selfsetUiBlock()
UI block is a spinner shown during browser rendering phase of the module, automatically removed when rendering finished. This is done by default, but the UI block can be turned off when needed for whatever reason.
public
setUiBlock(bool $uiBlock) : self
Parameters
- $uiBlock : bool
Return values
selfdispatchNotificationMessages()
Dispatches all messages in a special FlashMessageQueue to the PageRenderer to be rendered as inline notifications
protected
dispatchNotificationMessages() : void
getBackendFavicon()
Retrieves configured favicon for backend with fallback.
protected
getBackendFavicon(ExtensionConfiguration $extensionConfiguration, ServerRequestInterface $request) : string
Parameters
- $extensionConfiguration : ExtensionConfiguration
- $request : ServerRequestInterface
Return values
stringgetBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetNormalizedParams()
protected
getNormalizedParams(ServerRequestInterface $request) : NormalizedParams
Parameters
- $request : ServerRequestInterface
Return values
NormalizedParamsgetUriForFileName()
Returns the uri of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the project root of the TYPO3 installation
protected
getUriForFileName(ServerRequestInterface $request, string $filename) : string
Parameters
- $request : ServerRequestInterface
- $filename : string
-
The input filename/filepath to evaluate
Return values
string —Returns the filename of $filename if valid, otherwise blank string.
loadStylesheets()
Load all registered stylesheets from $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']
protected
loadStylesheets(PageRenderer $pageRenderer) : void
Parameters
- $pageRenderer : PageRenderer
prepareRender()
protected
prepareRender(string $templateFileName) : void
Parameters
- $templateFileName : string
setUpBasicPageRendererForBackend()
Sets mandatory parameters for the PageRenderer.
protected
setUpBasicPageRendererForBackend(PageRenderer $pageRenderer, ExtensionConfiguration $extensionConfiguration, ServerRequestInterface $request, LanguageService $languageService) : void
Parameters
- $pageRenderer : PageRenderer
- $extensionConfiguration : ExtensionConfiguration
- $request : ServerRequestInterface
- $languageService : LanguageService