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
- $legacyView : StandaloneView|null
- $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.
- getBodyTag() : string
- Returns the current body tag.
- getDocHeaderComponent() : DocHeaderComponent
- Get the DocHeader. Can be used in controllers to add custom buttons / menus / ... to the doc header.
- getDynamicTabMenu() : string
- Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup
- getView() : StandaloneView
- header() : string
- Returns the header-bar in the top of most backend modules Closes section if open.
- isUiBlock() : bool
- makeDocHeaderModuleMenu() : self
- Generates a menu in the docheader to access third-level modules
- registerModuleMenu() : self
- Generates the Menu for things like Web->Info
- render() : string
- Render the module.
- renderContent() : string
- 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.
- setContent() : self
- 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
- getRegisteredStylesheetFolders() : array<string|int, mixed>
- Return an array of all stylesheet directories registered via $GLOBAlS['TBE_STYLES']['skins'].
- 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
- initLegacyView() : void
- loadStylesheets() : void
- Load all registered stylesheets from $GLOBALS['TBE_STYLES'] "API"
- 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
$legacyView
protected
StandaloneView|null
$legacyView
= null
Tags
$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 = '' ][, int|ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = true ]) : self
These messages are automatically rendered when the view is rendered.
Parameters
- $messageBody : string
- $messageTitle : string = ''
- $severity : int|ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
- $storeInSession : bool = true
Tags
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
selfgetBodyTag()
Returns the current body tag.
public
getBodyTag() : string
since v12, will be removed in v13.
Return values
stringgetDocHeaderComponent()
Get the DocHeader. Can be used in controllers to add custom buttons / menus / ... to the doc header.
public
getDocHeaderComponent() : DocHeaderComponent
Return values
DocHeaderComponentgetDynamicTabMenu()
Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup
public
getDynamicTabMenu(array<string|int, mixed> $menuItems, string $domId[, int $defaultTabIndex = 1 ][, bool $collapsible = false ][, bool $wrapContent = true ][, bool $storeLastActiveTab = true ]) : string
since v12, will be removed in v13.
Parameters
- $menuItems : array<string|int, mixed>
-
Tab elements, each element is an array with "label" and "content"
- $domId : string
-
DOM id attribute, will be appended with an iteration number per tab.
- $defaultTabIndex : int = 1
-
Default tab to open (for toggle <=0). Value corresponds to integer-array index + 1 (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing will result in no default tab open.
- $collapsible : bool = false
-
If set, the tabs are rendered as headers instead over each sheet. Effectively this means there is no tab menu, but rather a foldout/fold-in menu.
- $wrapContent : bool = true
-
If set, the content is wrapped in div structure which provides a padding and border style. Set this FALSE to get unstyled content pane with fullsize content area.
- $storeLastActiveTab : bool = true
-
If set, the last open tab is stored in local storage and will be re-open again. If you don't need this feature, e.g. for wizards like import/export you can disable this behaviour.
Return values
stringgetView()
public
getView() : StandaloneView
since v12, will be removed in v13.
Return values
StandaloneViewheader()
Returns the header-bar in the top of most backend modules Closes section if open.
public
header(string $text[, bool $inlineEdit = true ]) : string
since v12, will be removed in v13.
Parameters
- $text : string
-
The text string for the header
- $inlineEdit : bool = true
-
Whether the header should be editable (e.g. page title)
Return values
string —HTML content
isUiBlock()
public
isUiBlock() : bool
since v12, will be removed in v13.
Return values
boolmakeDocHeaderModuleMenu()
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
selfregisterModuleMenu()
Generates the Menu for things like Web->Info
public
registerModuleMenu(string $moduleMenuIdentifier) : self
since v12, will be removed in v13.
Parameters
- $moduleMenuIdentifier : string
Return values
selfrender()
Render the module.
public
render([string $templateFileName = '' ]) : string
Parameters
- $templateFileName : string = ''
Return values
stringrenderContent()
public
renderContent() : string
since v12, will be removed in v13. Remove together with $legacyView property and Templates/Module.html.
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
selfsetContent()
public
setContent(string $content) : self
since v12, will be removed in v13.
Parameters
- $content : 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
NormalizedParamsgetRegisteredStylesheetFolders()
Return an array of all stylesheet directories registered via $GLOBAlS['TBE_STYLES']['skins'].
protected
getRegisteredStylesheetFolders() : array<string|int, mixed>
will be removed in TYPO3 v13.0. Use $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets'] instead.
Return values
array<string|int, mixed>getUriForFileName()
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.
initLegacyView()
protected
initLegacyView() : void
since v12, will be removed in v13.
loadStylesheets()
Load all registered stylesheets from $GLOBALS['TBE_STYLES'] "API"
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