TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Backend\Template\ModuleTemplate Class Reference

Public Member Functions

 getBodyTag ()
 
 setBodyTag ($bodyTag)
 
 getView ()
 
 setContent ($content)
 
 setTitle ($title)
 
 getIconFactory ()
 
 __construct ()
 
 addJavaScriptCode ($name='', $code='')
 
 getDocHeaderComponent ()
 
 renderContent ()
 
 getPageRenderer ()
 
 setForm ($formTag='')
 
 setModuleId ($moduleId)
 
 setModuleName ($moduleName)
 
 registerModuleMenu ($moduleMenuIdentifier)
 
 getDynamicTabMenu (array $menuItems, $domId, $defaultTabIndex=1, $collapsible=false, $wrapContent=true, $storeLastActiveTab=true)
 
 loadJavascriptLib ($lib)
 
 makeShortcutIcon ($gvList, $setList, $modName, $motherModName='', $displayName='', $classes='btn btn-default btn-sm')
 
 makeShortcutUrl ($gvList, $setList)
 
 icons ($type)
 
 redirectUrls ($thisLocation='')
 
 header ($text)
 
 addFlashMessage ($messageBody, $messageTitle='', $severity=AbstractMessage::OK, $storeInSession=true)
 
 setFlashMessageQueue ($flashMessageQueue)
 
 isUiBlock ()
 
 setUiBlock (bool $uiBlock)
 

Public Attributes

const STATUS_ICON_ERROR = 3
 
const STATUS_ICON_WARNING = 2
 
const STATUS_ICON_NOTIFICATION = 1
 
const STATUS_ICON_OK = -1
 

Protected Member Functions

 loadJavaScripts ()
 
 loadStylesheets ()
 
 setupPage ()
 
 setJavaScriptCodeArray ()
 
 getBackendUserAuthentication ()
 
 getLanguageService ()
 

Protected Attributes

 $docHeaderComponent
 
 $javascriptCodeArray = []
 
 $pageRenderer
 
 $uiBlock = false
 
 $templateRootPaths = ['EXT:backend/Resources/Private/Templates']
 
 $partialRootPaths = ['EXT:backend/Resources/Private/Partials']
 
 $layoutRootPaths = ['EXT:backend/Resources/Private/Layouts']
 
 $templateFile = 'Module.html'
 
 $view
 
 $content = ''
 
 $iconFactory
 
 $moduleId = ''
 
 $moduleName = ''
 
 $title = ''
 
 $bodyTag = '<body>'
 
 $flashMessageQueue
 

Detailed Description

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

Definition at line 37 of file ModuleTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Template\ModuleTemplate::__construct ( )

Class constructor Sets up view and property objects

Exceptions
InvalidTemplateResourceExceptionIn case a template is invalid

Definition at line 244 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Function Documentation

◆ addFlashMessage()

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$messageBodyThe message
string$messageTitleOptional message title
int$severityOptional severity, must be one of constants
bool$storeInSessionOptional, defines whether the message should be stored in the session (default)
Exceptions

Definition at line 703 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ addJavaScriptCode()

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

Adds JS inline blocks of code to the internal registry

Parameters
string$nameJavascript code block name
string$codeInline Javascript

Definition at line 309 of file ModuleTemplate.php.

◆ getBackendUserAuthentication()

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

Returns the BE USER Object

Returns
BackendUserAuthentication

Definition at line 599 of file ModuleTemplate.php.

References $GLOBALS.

◆ getBodyTag()

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

Returns the current body tag

Returns
string

Definition at line 183 of file ModuleTemplate.php.

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

◆ getDocHeaderComponent()

TYPO3\CMS\Backend\Template\ModuleTemplate::getDocHeaderComponent ( )

◆ getDynamicTabMenu()

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$menuItemsTab elements, each element is an array with "label" and "content"
string$domIdDOM id attribute, will be appended with an iteration number per tab.
int$defaultTabIndexDefault 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$collapsibleIf 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$wrapContentIf 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$storeLastActiveTabIf 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 434 of file ModuleTemplate.php.

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

◆ getIconFactory()

TYPO3\CMS\Backend\Template\ModuleTemplate::getIconFactory ( )

Returns the IconFactory

Returns
IconFactory

Definition at line 233 of file ModuleTemplate.php.

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

◆ getLanguageService()

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

Returns the LanguageService

Returns
LanguageService

Definition at line 609 of file ModuleTemplate.php.

References $GLOBALS.

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

◆ getPageRenderer()

TYPO3\CMS\Backend\Template\ModuleTemplate::getPageRenderer ( )

Get PageRenderer

Returns
PageRenderer

Definition at line 360 of file ModuleTemplate.php.

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

◆ getView()

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

Gets the standalone view.

Returns
StandaloneView

Definition at line 203 of file ModuleTemplate.php.

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

◆ header()

TYPO3\CMS\Backend\Template\ModuleTemplate::header (   $text)

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

Parameters
string$textThe text string for the header
Returns
string HTML content

Definition at line 685 of file ModuleTemplate.php.

◆ icons()

TYPO3\CMS\Backend\Template\ModuleTemplate::icons (   $type)

Returns an image-tag with an 18x16 icon of the following types:

$type: -1:» OK icon (Check-mark) 1:» Notice (Speach-bubble) 2:» Warning (Yellow triangle) 3:» Fatal error (Red stop sign)

Parameters
int$typeSee description
Returns
string HTML image tag (if applicable)

Definition at line 628 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

◆ isUiBlock()

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

Definition at line 743 of file ModuleTemplate.php.

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

◆ loadJavascriptLib()

TYPO3\CMS\Backend\Template\ModuleTemplate::loadJavascriptLib (   $lib)

Includes a javascript library that exists in the core /typo3/ directory

Parameters
string$libLibrary name. Call it with the full path like "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it

Definition at line 473 of file ModuleTemplate.php.

◆ loadJavaScripts()

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

Loads all necessary Javascript Files

Definition at line 259 of file ModuleTemplate.php.

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

◆ loadStylesheets()

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

Loads all necessary stylesheets

Definition at line 271 of file ModuleTemplate.php.

References $GLOBALS.

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

◆ makeShortcutIcon()

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$gvListIs the list of GET variables to store (if any)
string$setListIs 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$motherModNameIs 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$displayNameWhen given this name is used instead of the module name.
string$classesAdditional CSS classes for the link around the icon
Returns
string HTML content
Todo:
Make this thing return a button object

Definition at line 502 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$moduleName, TYPO3\CMS\Core\Utility\GeneralUtility\_GET(), TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv(), TYPO3\CMS\Backend\Template\ModuleTemplate\getLanguageService(), TYPO3\CMS\Backend\Template\ModuleTemplate\makeShortcutUrl(), TYPO3\CMS\Core\Utility\GeneralUtility\quoteJSvalue(), TYPO3\CMS\Backend\Utility\BackendUtility\shortcutExists(), and TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

◆ makeShortcutUrl()

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

MAKE url for storing Internal func

Parameters
string$gvListIs the list of GET variables to store (if any)
string$setListIs the list of SET[] variables to store (if any)
  • SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
Returns
string

Definition at line 556 of file ModuleTemplate.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\_GET(), TYPO3\CMS\Core\Utility\GeneralUtility\compileSelectedGetVarsFromArray(), TYPO3\CMS\Core\Utility\GeneralUtility\implodeArrayForUrl(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

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

◆ redirectUrls()

TYPO3\CMS\Backend\Template\ModuleTemplate::redirectUrls (   $thisLocation = '')

Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page. Used in fx. db_list.php (Web>List)

Parameters
string$thisLocationURL to "this location" / current script
Returns
string Urls are returned as JavaScript variables T3_RETURN_URL and T3_THIS_LOCATION
See also
typo3/db_list.php

Definition at line 662 of file ModuleTemplate.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\_GP(), TYPO3\CMS\Core\Utility\GeneralUtility\linkThisScript(), TYPO3\CMS\Core\Utility\GeneralUtility\quoteJSvalue(), and TYPO3\CMS\Core\Utility\GeneralUtility\sanitizeLocalUrl().

◆ registerModuleMenu()

TYPO3\CMS\Backend\Template\ModuleTemplate::registerModuleMenu (   $moduleMenuIdentifier)

Generates the Menu for things like Web->Info

Parameters
$moduleMenuIdentifier

Definition at line 401 of file ModuleTemplate.php.

References $GLOBALS, and TYPO3\CMS\Backend\Template\ModuleTemplate\getDocHeaderComponent().

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

◆ renderContent()

◆ setBodyTag()

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

Sets the body tag

Parameters
string$bodyTag

Definition at line 193 of file ModuleTemplate.php.

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

◆ setContent()

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

Set content

Parameters
string$contentContent of the module

Definition at line 213 of file ModuleTemplate.php.

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

◆ setFlashMessageQueue()

TYPO3\CMS\Backend\Template\ModuleTemplate::setFlashMessageQueue (   $flashMessageQueue)
Parameters
\TYPO3\CMS\Core\Messaging\FlashMessageQueue$flashMessageQueue

Definition at line 722 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$flashMessageQueue, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ setForm()

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

Set form tag

Parameters
string$formTagForm tag to add

Definition at line 370 of file ModuleTemplate.php.

◆ setJavaScriptCodeArray()

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

Wrapper function for adding JS inline blocks

Definition at line 296 of file ModuleTemplate.php.

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

◆ setModuleId()

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

Sets the ModuleId

Parameters
string$moduleIdID of the module

Definition at line 380 of file ModuleTemplate.php.

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

◆ setModuleName()

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

Sets the ModuleName

Parameters
string$moduleNameName of the module

Definition at line 391 of file ModuleTemplate.php.

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

◆ setTitle()

TYPO3\CMS\Backend\Template\ModuleTemplate::setTitle (   $title)

Set title tag

Parameters
string$title

Definition at line 223 of file ModuleTemplate.php.

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

◆ setUiBlock()

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

Definition at line 751 of file ModuleTemplate.php.

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

◆ setupPage()

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

Sets mandatory parameters for the view (pageRenderer)

Definition at line 284 of file ModuleTemplate.php.

References $GLOBALS.

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

Member Data Documentation

◆ $bodyTag

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

◆ $content

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

◆ $docHeaderComponent

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

◆ $flashMessageQueue

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

◆ $iconFactory

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

◆ $javascriptCodeArray

TYPO3\CMS\Backend\Template\ModuleTemplate::$javascriptCodeArray = []
protected

Definition at line 80 of file ModuleTemplate.php.

◆ $layoutRootPaths

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

Definition at line 113 of file ModuleTemplate.php.

◆ $moduleId

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

◆ $moduleName

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

◆ $pageRenderer

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

◆ $partialRootPaths

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

Definition at line 106 of file ModuleTemplate.php.

◆ $templateFile

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

Definition at line 120 of file ModuleTemplate.php.

◆ $templateRootPaths

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

Definition at line 99 of file ModuleTemplate.php.

◆ $title

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

◆ $uiBlock

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

◆ $view

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

◆ STATUS_ICON_ERROR

const TYPO3\CMS\Backend\Template\ModuleTemplate::STATUS_ICON_ERROR = 3

Error Icon Constant

Definition at line 44 of file ModuleTemplate.php.

◆ STATUS_ICON_NOTIFICATION

const TYPO3\CMS\Backend\Template\ModuleTemplate::STATUS_ICON_NOTIFICATION = 1

Notification Icon Constant

Definition at line 58 of file ModuleTemplate.php.

◆ STATUS_ICON_OK

const TYPO3\CMS\Backend\Template\ModuleTemplate::STATUS_ICON_OK = -1

OK Icon Constant

Definition at line 65 of file ModuleTemplate.php.

◆ STATUS_ICON_WARNING

const TYPO3\CMS\Backend\Template\ModuleTemplate::STATUS_ICON_WARNING = 2

Warning Icon Constant

Definition at line 51 of file ModuleTemplate.php.