‪TYPO3CMS  11.5
TYPO3\CMS\Backend\Template\ModuleTemplate Class Reference

Public Member Functions

string getBodyTag ()
 
self setBodyTag ($bodyTag)
 
StandaloneView getView ()
 
self setContent ($content)
 
self setTitle ($title, $context='')
 
 getIconFactory ()
 
 __construct (PageRenderer $pageRenderer, IconFactory $iconFactory, FlashMessageService $flashMessageService, ?ServerRequestInterface $request=null, ?ViewInterface $view=null)
 
self addJavaScriptCode ($name='', $code='')
 
DocHeaderComponent getDocHeaderComponent ()
 
string renderContent ()
 
 getPageRenderer ()
 
self setForm ($formTag='')
 
self setModuleId ($moduleId)
 
self setModuleName ($moduleName)
 
self setModuleClass ($moduleClass)
 
self registerModuleMenu ($moduleMenuIdentifier)
 
string getDynamicTabMenu (array $menuItems, $domId, $defaultTabIndex=1, $collapsible=false, $wrapContent=true, $storeLastActiveTab=true)
 
string makeShortcutIcon ($gvList, $setList, $modName, $motherModName='', $displayName='', $classes='btn btn-default btn-sm')
 
string makeShortcutUrl ($gvList, $setList)
 
string header (string $text, bool $inlineEdit=true)
 
self addFlashMessage ($messageBody, $messageTitle='', $severity=AbstractMessage::OK, $storeInSession=true)
 
self setFlashMessageQueue ($flashMessageQueue)
 
bool isUiBlock ()
 
self setUiBlock (bool $uiBlock)
 

Protected Member Functions

 loadJavaScripts ()
 
 loadStylesheets ()
 
 getRegisteredStylesheetFolders ()
 
 setupPage ()
 
 setJavaScriptCodeArray ()
 
array getCreateShortcutProperties (string $shortcutUrl)
 
string getBackendFavicon ()
 
string getUriForFileName ($filename)
 
BackendUserAuthentication getBackendUserAuthentication ()
 
LanguageService getLanguageService ()
 

Protected Attributes

DocHeaderComponent $docHeaderComponent
 
array $javascriptCodeArray = array( )
 
PageRenderer $pageRenderer
 
bool $uiBlock = false
 
string[] $templateRootPaths = array( 'EXT:backend/Resources/Private/Templates' )
 
string[] $partialRootPaths = array( 'EXT:backend/Resources/Private/Partials' )
 
string[] $layoutRootPaths = array( 'EXT:backend/Resources/Private/Layouts' )
 
string $templateFile = 'Module.html'
 
ViewInterface $view
 
string $content = ''
 
IconFactory $iconFactory
 
FlashMessageQueue $flashMessageQueue
 
ServerRequestInterface $request
 
string $moduleId = ''
 
string $moduleName = ''
 
string $moduleClass = ''
 
string $title = ''
 
string $bodyTag = '<body>'
 

Detailed Description

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

Definition at line 45 of file ModuleTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Template\ModuleTemplate::__construct ( PageRenderer  $pageRenderer,
IconFactory  $iconFactory,
FlashMessageService  $flashMessageService,
?ServerRequestInterface  $request = null,
?ViewInterface  $view = null 
)

Member Function Documentation

◆ addFlashMessage()

self TYPO3\CMS\Backend\Template\ModuleTemplate::addFlashMessage (   $messageBody,
  $messageTitle = '',
  $severity = AbstractMessage::OK,
  $storeInSession = true 
)

Creates a Message object and adds it to the FlashMessageQueue.

Parameters
string$messageBody‪The message
string$messageTitle‪Optional message title
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
bool$storeInSession‪Optional, defines whether the message should be stored in the session (default)
Exceptions

Definition at line 763 of file ModuleTemplate.php.

◆ addJavaScriptCode()

self TYPO3\CMS\Backend\Template\ModuleTemplate::addJavaScriptCode (   $name = '',
  $code = '' 
)

Adds JS inline blocks of code to the internal registry

Parameters
string$name‪Javascript code block name
string$code‪Inline Javascript
Returns
‪self

Not used anymore, will be removed in TYPO3 v12.0

Definition at line 359 of file ModuleTemplate.php.

◆ getBackendFavicon()

string TYPO3\CMS\Backend\Template\ModuleTemplate::getBackendFavicon ( )
protected

Retrieves configured favicon for backend (with fallback)

Returns
‪string

Definition at line 683 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Utility\PathUtility\getPublicResourceWebPath(), and TYPO3\CMS\Backend\Template\ModuleTemplate\getUriForFileName().

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\setupPage().

◆ getBackendUserAuthentication()

BackendUserAuthentication TYPO3\CMS\Backend\Template\ModuleTemplate::getBackendUserAuthentication ( )
protected

Returns the BE USER Object

Returns
‪BackendUserAuthentication

Definition at line 720 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\loadJavaScripts().

◆ getBodyTag()

string TYPO3\CMS\Backend\Template\ModuleTemplate::getBodyTag ( )

Returns the current body tag

Returns
‪string

Definition at line 146 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$bodyTag.

◆ getCreateShortcutProperties()

array TYPO3\CMS\Backend\Template\ModuleTemplate::getCreateShortcutProperties ( string  $shortcutUrl)
protected

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

Parameters
string$shortcutUrl
Returns
‪array
Deprecated:
‪Only for backwards compatibility. Can be removed in v12

Definition at line 652 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\makeShortcutIcon().

◆ getDocHeaderComponent()

◆ getDynamicTabMenu()

string TYPO3\CMS\Backend\Template\ModuleTemplate::getDynamicTabMenu ( array  $menuItems,
  $domId,
  $defaultTabIndex = 1,
  $collapsible = false,
  $wrapContent = true,
  $storeLastActiveTab = true 
)

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

Parameters
array$menuItems‪Tab elements, each element is an array with "label" and "content"
string$domId‪DOM id attribute, will be appended with an iteration number per tab.
int$defaultTabIndex‪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.
bool$collapsible‪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.
bool$wrapContent‪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.
bool$storeLastActiveTab‪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.
Returns
‪string

Definition at line 516 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$view, and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath().

◆ getIconFactory()

TYPO3\CMS\Backend\Template\ModuleTemplate::getIconFactory ( )
Deprecated:
‪since v11, will be removed in v12

Definition at line 207 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$iconFactory.

◆ getLanguageService()

LanguageService TYPO3\CMS\Backend\Template\ModuleTemplate::getLanguageService ( )
protected

Returns the LanguageService

Returns
‪LanguageService

Definition at line 730 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\makeShortcutIcon(), and TYPO3\CMS\Backend\Template\ModuleTemplate\setupPage().

◆ getPageRenderer()

TYPO3\CMS\Backend\Template\ModuleTemplate::getPageRenderer ( )
Deprecated:
‪since v11, will be removed in v12

Definition at line 418 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$pageRenderer.

◆ getRegisteredStylesheetFolders()

TYPO3\CMS\Backend\Template\ModuleTemplate::getRegisteredStylesheetFolders ( )
protected

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

Definition at line 304 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\loadStylesheets().

◆ getUriForFileName()

string TYPO3\CMS\Backend\Template\ModuleTemplate::getUriForFileName (   $filename)
protected

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

Parameters
string$filename‪The input filename/filepath to evaluate
Returns
‪string Returns the filename of $filename if valid, otherwise blank string.

Definition at line 701 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Utility\PathUtility\getPublicResourceWebPath(), TYPO3\CMS\Core\Utility\PathUtility\hasProtocolAndScheme(), and TYPO3\CMS\Core\Utility\PathUtility\isExtensionPath().

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\getBackendFavicon().

◆ getView()

StandaloneView TYPO3\CMS\Backend\Template\ModuleTemplate::getView ( )

Gets the standalone view.

Returns
‪StandaloneView

Definition at line 168 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$view.

◆ header()

string TYPO3\CMS\Backend\Template\ModuleTemplate::header ( string  $text,
bool  $inlineEdit = true 
)

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

Parameters
string$text‪The text string for the header
bool$inlineEdit‪Whether the header should be editable (e.g. page title)
Returns
‪string HTML content

Definition at line 744 of file ModuleTemplate.php.

◆ isUiBlock()

bool TYPO3\CMS\Backend\Template\ModuleTemplate::isUiBlock ( )
Returns
‪bool

Definition at line 793 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$uiBlock.

◆ loadJavaScripts()

TYPO3\CMS\Backend\Template\ModuleTemplate::loadJavaScripts ( )
protected

◆ loadStylesheets()

TYPO3\CMS\Backend\Template\ModuleTemplate::loadStylesheets ( )
protected

◆ makeShortcutIcon()

string TYPO3\CMS\Backend\Template\ModuleTemplate::makeShortcutIcon (   $gvList,
  $setList,
  $modName,
  $motherModName = '',
  $displayName = '',
  $classes = 'btn btn-default btn-sm' 
)

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

Parameters
string$gvList‪Is the list of GET variables to store (if any)
string$setList‪Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
string$modNameModule name string
string | int$motherModName‪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.
string$displayName‪When given this name is used instead of the module name.
string$classes‪Additional CSS classes for the link around the icon
Returns
‪string HTML content
Todo:
‪Make this thing return a button object
Deprecated:
‪since v11, will be removed in v12

Definition at line 570 of file ModuleTemplate.php.

References $GLOBALS, TYPO3\CMS\Backend\Template\ModuleTemplate\$moduleName, TYPO3\CMS\Backend\Template\ModuleTemplate\getCreateShortcutProperties(), TYPO3\CMS\Backend\Template\ModuleTemplate\getLanguageService(), TYPO3\CMS\Backend\Template\ModuleTemplate\makeShortcutUrl(), TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL, and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ makeShortcutUrl()

string TYPO3\CMS\Backend\Template\ModuleTemplate::makeShortcutUrl (   $gvList,
  $setList 
)

MAKE url for storing Internal func

Parameters
string$gvList‪Is the list of GET variables to store (if any)
string$setList‪Is the list of SET[] variables to store (if any)
  • ‪SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
Returns
‪string GET-parameters for the shortcut-url only(!). String starts with '&'
Deprecated:
‪since v11, will be removed in v12. Deprecation logged by parent method makeShortcutIcon()

Definition at line 633 of file ModuleTemplate.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString().

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\makeShortcutIcon().

◆ registerModuleMenu()

◆ renderContent()

string TYPO3\CMS\Backend\Template\ModuleTemplate::renderContent ( )

Returns the fully rendered view

Returns
‪string

Definition at line 380 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\setJavaScriptCodeArray().

◆ setBodyTag()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setBodyTag (   $bodyTag)

Sets the body tag

Parameters
string$bodyTag
Returns
‪self

Definition at line 157 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$bodyTag.

◆ setContent()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setContent (   $content)

Set content

Parameters
string$content‪Content of the module
Returns
‪self

Definition at line 179 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$content.

◆ setFlashMessageQueue()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setFlashMessageQueue (   $flashMessageQueue)
Parameters
FlashMessageQueue$flashMessageQueue
Returns
‪self

Definition at line 784 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$flashMessageQueue.

◆ setForm()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setForm (   $formTag = '')

Set form tag

Parameters
string$formTagForm tag to add
Returns
‪self

Definition at line 433 of file ModuleTemplate.php.

◆ setJavaScriptCodeArray()

TYPO3\CMS\Backend\Template\ModuleTemplate::setJavaScriptCodeArray ( )
protected

Wrapper function for adding JS inline blocks

Only used internally, will be removed in TYPO3 v12.0

Definition at line 344 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\renderContent().

◆ setModuleClass()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setModuleClass (   $moduleClass)

Sets the ModuleClass

Parameters
string$moduleClass‪Class of the module
Returns
‪self

Definition at line 470 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$moduleClass.

◆ setModuleId()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setModuleId (   $moduleId)

Sets the ModuleId

Parameters
string$moduleId‪ID of the module
Returns
‪self

Definition at line 445 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$moduleId, and TYPO3\CMS\Backend\Template\ModuleTemplate\registerModuleMenu().

◆ setModuleName()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setModuleName (   $moduleName)

Sets the ModuleName

Parameters
string$moduleName‪Name of the module
Returns
‪self

Definition at line 458 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$moduleName.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\__construct().

◆ setTitle()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setTitle (   $title,
  $context = '' 
)

Set title tag

Parameters
string$title
string$context
Returns
‪self

Definition at line 192 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$title.

◆ setUiBlock()

self TYPO3\CMS\Backend\Template\ModuleTemplate::setUiBlock ( bool  $uiBlock)
Parameters
bool$uiBlock
Returns
‪self

Definition at line 802 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$uiBlock.

◆ setupPage()

TYPO3\CMS\Backend\Template\ModuleTemplate::setupPage ( )
protected

Member Data Documentation

◆ $bodyTag

string TYPO3\CMS\Backend\Template\ModuleTemplate::$bodyTag = '<body>'
protected

◆ $content

string TYPO3\CMS\Backend\Template\ModuleTemplate::$content = ''
protected

Content String

Definition at line 105 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\setContent().

◆ $docHeaderComponent

DocHeaderComponent TYPO3\CMS\Backend\Template\ModuleTemplate::$docHeaderComponent
protected

DocHeaderComponent

Definition at line 51 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\getDocHeaderComponent().

◆ $flashMessageQueue

FlashMessageQueue TYPO3\CMS\Backend\Template\ModuleTemplate::$flashMessageQueue
protected

◆ $iconFactory

IconFactory TYPO3\CMS\Backend\Template\ModuleTemplate::$iconFactory
protected

◆ $javascriptCodeArray

array TYPO3\CMS\Backend\Template\ModuleTemplate::$javascriptCodeArray = array( )
protected

Javascript Code Array Used for inline JS

Only used internally, will be removed in TYPO3 v12.0

Definition at line 59 of file ModuleTemplate.php.

◆ $layoutRootPaths

string [] TYPO3\CMS\Backend\Template\ModuleTemplate::$layoutRootPaths = array( 'EXT:backend/Resources/Private/Layouts' )
protected

LayoutRootPath

Definition at line 87 of file ModuleTemplate.php.

◆ $moduleClass

string TYPO3\CMS\Backend\Template\ModuleTemplate::$moduleClass = ''
protected

◆ $moduleId

string TYPO3\CMS\Backend\Template\ModuleTemplate::$moduleId = ''
protected

◆ $moduleName

string TYPO3\CMS\Backend\Template\ModuleTemplate::$moduleName = ''
protected

◆ $pageRenderer

PageRenderer TYPO3\CMS\Backend\Template\ModuleTemplate::$pageRenderer
protected

◆ $partialRootPaths

string [] TYPO3\CMS\Backend\Template\ModuleTemplate::$partialRootPaths = array( 'EXT:backend/Resources/Private/Partials' )
protected

PartialRootPath

Definition at line 81 of file ModuleTemplate.php.

◆ $request

ServerRequestInterface TYPO3\CMS\Backend\Template\ModuleTemplate::$request
protected

◆ $templateFile

string TYPO3\CMS\Backend\Template\ModuleTemplate::$templateFile = 'Module.html'
protected

Template name

Definition at line 93 of file ModuleTemplate.php.

◆ $templateRootPaths

string [] TYPO3\CMS\Backend\Template\ModuleTemplate::$templateRootPaths = array( 'EXT:backend/Resources/Private/Templates' )
protected

TemplateRootPath

Definition at line 75 of file ModuleTemplate.php.

◆ $title

string TYPO3\CMS\Backend\Template\ModuleTemplate::$title = ''
protected

Title Tag

Definition at line 133 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\setTitle().

◆ $uiBlock

bool TYPO3\CMS\Backend\Template\ModuleTemplate::$uiBlock = false
protected

◆ $view

ViewInterface TYPO3\CMS\Backend\Template\ModuleTemplate::$view
protected