ModuleTemplate

class \TYPO3\CMS\Backend\Template\ModuleTemplate

A class taking care of the "outer" HTML of a module, especially the doc header and other related parts.

Table of Contents

Properties

$bodyTag  : string
Body Tag
$content  : string
Content String
$docHeaderComponent  : DocHeaderComponent
DocHeaderComponent
$flashMessageQueue  : FlashMessageQueue
$iconFactory  : IconFactory
$javascriptCodeArray  : array
Javascript Code Array Used for inline JS
$layoutRootPaths  : string[]
LayoutRootPath
$moduleClass  : string
Module Class
$moduleId  : string
Module ID
$moduleName  : string
Module Name
$pageRenderer  : PageRenderer
Expose the pageRenderer
$partialRootPaths  : string[]
PartialRootPath
$request  : ServerRequestInterface
$templateFile  : string
Template name
$templateRootPaths  : string[]
TemplateRootPath
$title  : string
Title Tag
$uiBlock  : bool
$view  : ViewInterface
Fluid Standalone View

Methods

__construct()  : mixed
Class constructor Sets up view and property objects
addFlashMessage()  : self
Creates a Message object and adds it to the FlashMessageQueue.
addJavaScriptCode()  : self
Adds JS inline blocks of code to the internal registry
getBodyTag()  : string
Returns the current body tag
getDocHeaderComponent()  : DocHeaderComponent
Get the DocHeader
getDynamicTabMenu()  : string
Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup
getIconFactory()  : IconFactory
getPageRenderer()  : PageRenderer
getView()  : StandaloneView
Gets the standalone view.
header()  : string
Returns the header-bar in the top of most backend modules Closes section if open.
isUiBlock()  : bool
makeShortcutIcon()  : string
Returns a linked shortcut-icon which will call the shortcut frame and set a shortcut there back to the calling page/module
makeShortcutUrl()  : string
MAKE url for storing Internal func
registerModuleMenu()  : self
Generates the Menu for things like Web->Info
renderContent()  : string
Returns the fully rendered view
setBodyTag()  : self
Sets the body tag
setContent()  : self
Set content
setFlashMessageQueue()  : self
setForm()  : self
Set form tag
setModuleClass()  : self
Sets the ModuleClass
setModuleId()  : self
Sets the ModuleId
setModuleName()  : self
Sets the ModuleName
setTitle()  : self
Set title tag
setUiBlock()  : self
getBackendFavicon()  : string
Retrieves configured favicon for backend (with fallback)
getBackendUserAuthentication()  : BackendUserAuthentication
Returns the BE USER Object
getCreateShortcutProperties()  : array
Process the generated shortcut url and return properties needed for the shortcut registration with route identifier and JSON encoded arguments.
getLanguageService()  : LanguageService
Returns the LanguageService
getRegisteredStylesheetFolders()  : array
Returns an array of all stylesheet directories registered via $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
loadJavaScripts()  : mixed
Loads all necessary Javascript Files
loadStylesheets()  : mixed
Loads all necessary stylesheets
setJavaScriptCodeArray()  : mixed
Wrapper function for adding JS inline blocks
setupPage()  : mixed
Sets mandatory parameters for the view (pageRenderer)

Properties

$bodyTag

Body Tag

protected string $bodyTag = '<body>'

$content

Content String

protected string $content = ''

$javascriptCodeArray

Javascript Code Array Used for inline JS

protected array $javascriptCodeArray = []

$layoutRootPaths

LayoutRootPath

protected string[] $layoutRootPaths = ['EXT:backend/Resources/Private/Layouts']

$moduleClass

Module Class

protected string $moduleClass = ''

$moduleId

Module ID

protected string $moduleId = ''

$moduleName

Module Name

protected string $moduleName = ''

$partialRootPaths

PartialRootPath

protected string[] $partialRootPaths = ['EXT:backend/Resources/Private/Partials']

$request

protected ServerRequestInterface $request

$templateFile

Template name

protected string $templateFile = 'Module.html'

$templateRootPaths

TemplateRootPath

protected string[] $templateRootPaths = ['EXT:backend/Resources/Private/Templates']

$title

Title Tag

protected string $title = ''

$view

Fluid Standalone View

protected ViewInterface $view

Methods

__construct()

Class constructor Sets up view and property objects

public __construct(PageRenderer $pageRenderer, IconFactory $iconFactory, FlashMessageService $flashMessageService[, ServerRequestInterface|null $request = null ][, ViewInterface|null $view = null ]) : mixed

Parameters

$pageRenderer : PageRenderer
$iconFactory : IconFactory
$flashMessageService : FlashMessageService
$request : ServerRequestInterface|null = null
$view : ViewInterface|null = null

addFlashMessage()

Creates a Message object and adds it to the FlashMessageQueue.

public addFlashMessage(string $messageBody[, string $messageTitle = '' ][, int $severity = AbstractMessage::OK ][, bool $storeInSession = true ]) : self

Parameters

$messageBody : string

The message

$messageTitle : string = ''

Optional message title

$severity : int = AbstractMessage::OK

Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants

$storeInSession : bool = true

Optional, defines whether the message should be stored in the session (default)

Tags

throws
InvalidArgumentException

if the message body is no string

Return values

self

addJavaScriptCode()

Adds JS inline blocks of code to the internal registry

public addJavaScriptCode([string $name = '' ][, string $code = '' ]) : self

Parameters

$name : string = ''

Javascript code block name

$code : string = ''

Inline Javascript

Return values

self

getBodyTag()

Returns the current body tag

public getBodyTag() : string

Return values

string

getDynamicTabMenu()

Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup

public getDynamicTabMenu(array $menuItems, string $domId[, int $defaultTabIndex = 1 ][, bool $collapsible = false ][, bool $wrapContent = true ][, bool $storeLastActiveTab = true ]) : string

Parameters

$menuItems : array

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

string

header()

Returns the header-bar in the top of most backend modules Closes section if open.

public header(string $text[, bool $inlineEdit = true ]) : string

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

Return values

bool

makeShortcutIcon()

Returns a linked shortcut-icon which will call the shortcut frame and set a shortcut there back to the calling page/module

public makeShortcutIcon(string $gvList, string $setList, string $modName[, string|int $motherModName = '' ][, string $displayName = '' ][, string $classes = 'btn btn-default btn-sm' ]) : string

Deprecated

since v11, will be removed in v12

Parameters

$gvList : string

Is the list of GET variables to store (if any)

$setList : string

Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules

$modName : string

Module name string

$motherModName : string|int = ''

Is used to enter the "parent module name" if the module is a submodule under eg. Web>* or File>*. You can also set this value to 1 in which case the currentLoadedModule is sent to the shortcut script (so - not a fixed value!) - that is used in file_edit and wizard_rte modules where those are really running as a part of another module.

$displayName : string = ''

When given this name is used instead of the module name.

$classes : string = 'btn btn-default btn-sm'

Additional CSS classes for the link around the icon

Tags

todo

Make this thing return a button object

Return values

string —

HTML content

makeShortcutUrl()

MAKE url for storing Internal func

public makeShortcutUrl(string $gvList, string $setList) : string

Deprecated

since v11, will be removed in v12. Deprecation logged by parent method makeShortcutIcon()

Parameters

$gvList : string

Is the list of GET variables to store (if any)

$setList : string

Is the list of SET[] variables to store (if any)

  • SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules

Return values

string —

GET-parameters for the shortcut-url only(!). String starts with '&'

registerModuleMenu()

Generates the Menu for things like Web->Info

public registerModuleMenu(string $moduleMenuIdentifier) : self

Parameters

$moduleMenuIdentifier : string

Return values

self

renderContent()

Returns the fully rendered view

public renderContent() : string

Return values

string

setBodyTag()

Sets the body tag

public setBodyTag(string $bodyTag) : self

Parameters

$bodyTag : string

Return values

self

setContent()

Set content

public setContent(string $content) : self

Parameters

$content : string

Content of the module

Return values

self

setForm()

Set form tag

public setForm([string $formTag = '' ]) : self

Parameters

$formTag : string = ''

Form tag to add

Return values

self

setModuleClass()

Sets the ModuleClass

public setModuleClass(string $moduleClass) : self

Parameters

$moduleClass : string

Class of the module

Return values

self

setModuleId()

Sets the ModuleId

public setModuleId(string $moduleId) : self

Parameters

$moduleId : string

ID of the module

Return values

self

setModuleName()

Sets the ModuleName

public setModuleName(string $moduleName) : self

Parameters

$moduleName : string

Name of the module

Return values

self

setTitle()

Set title tag

public setTitle(string $title[, string $context = '' ]) : self

Parameters

$title : string
$context : string = ''

Return values

self

setUiBlock()

public setUiBlock(bool $uiBlock) : self

Parameters

$uiBlock : bool

Return values

self

getBackendFavicon()

Retrieves configured favicon for backend (with fallback)

protected getBackendFavicon() : string

Return values

string

getCreateShortcutProperties()

Process the generated shortcut url and return properties needed for the shortcut registration with route identifier and JSON encoded arguments.

protected getCreateShortcutProperties(string $shortcutUrl) : array

Deprecated

Only for backwards compatibility. Can be removed in v12

Parameters

$shortcutUrl : string

Return values

array

getRegisteredStylesheetFolders()

Returns an array of all stylesheet directories registered via $TBE_STYLES['skins']

protected getRegisteredStylesheetFolders() : array

Return values

array

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(string $filename) : string

Parameters

$filename : string

The input filename/filepath to evaluate

Return values

string —

Returns the filename of $filename if valid, otherwise blank string.

loadJavaScripts()

Loads all necessary Javascript Files

protected loadJavaScripts() : mixed

loadStylesheets()

Loads all necessary stylesheets

protected loadStylesheets() : mixed

setJavaScriptCodeArray()

Wrapper function for adding JS inline blocks

protected setJavaScriptCodeArray() : mixed

setupPage()

Sets mandatory parameters for the view (pageRenderer)

protected setupPage() : mixed
On this page