TYPO3 CMS  TYPO3_7-6
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)
 
 section ($label, $text, $noStrToUpper=false, $sH=false, $type=0, $allowHtmlInHeader=false)
 
 divider ($dist)
 
 sectionHeader ($label, $sH=false, $addAttribute='')
 
 sectionBegin ()
 
 sectionEnd ()
 
 icons ($type)
 
 redirectUrls ($thisLocation='')
 
 header ($text)
 
 addFlashMessage ($messageBody, $messageTitle='', $severity=AbstractMessage::OK, $storeInSession=true)
 
 setFlashMessageQueue ($flashMessageQueue)
 
 isUiBlock ()
 
 setUiBlock ($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 = ''
 
 $sectionFlag = 0
 
 $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 38 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 253 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)
Returns
void
Exceptions

Definition at line 857 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
Returns
void

Definition at line 328 of file ModuleTemplate.php.

◆ divider()

TYPO3\CMS\Backend\Template\ModuleTemplate::divider (   $dist)

Inserts a divider image Ends a section (if open) before inserting the image

Parameters
int$distThe margin-top/-bottom of the
ruler.
Returns
string HTML content

Definition at line 660 of file ModuleTemplate.php.

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

◆ getBackendUserAuthentication()

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

Returns the BE USER Object

Returns
BackendUserAuthentication

Definition at line 751 of file ModuleTemplate.php.

References $GLOBALS.

◆ getBodyTag()

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

Returns the current body tag

Returns
string

Definition at line 191 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 459 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\$view, TYPO3\CMS\Core\Utility\GeneralUtility\getFileAbsFileName(), 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 242 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 761 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 379 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 211 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 837 of file ModuleTemplate.php.

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

◆ 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 780 of file ModuleTemplate.php.

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

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

◆ isUiBlock()

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

Definition at line 897 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
Returns
void

Definition at line 497 of file ModuleTemplate.php.

◆ loadJavaScripts()

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

Loads all necessary Javascript Files

Returns
void

Definition at line 270 of file ModuleTemplate.php.

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

◆ loadStylesheets()

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

Loads all necessary stylesheets

Returns
void

Definition at line 284 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 526 of file ModuleTemplate.php.

References $GLOBALS, 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 580 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 814 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 426 of file ModuleTemplate.php.

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

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

◆ renderContent()

◆ section()

TYPO3\CMS\Backend\Template\ModuleTemplate::section (   $label,
  $text,
  $noStrToUpper = false,
  $sH = false,
  $type = 0,
  $allowHtmlInHeader = false 
)

Begins an output section and sets header and content

Parameters
string$labelThe header
string$textThe HTML-content
bool$noStrToUpperA flag that will prevent the header from being converted to uppercase
bool$sHDefines the type of header (if set, "<h3>" rather than the default "h4")
int$typeThe number of an icon to show with the header (see the icon-function). -1,1,2,3
bool$allowHtmlInHeaderIf set, HTML tags are allowed in $label (otherwise this value is by default htmlspecialchars()'ed)
Returns
string HTML content

Definition at line 633 of file ModuleTemplate.php.

References TYPO3\CMS\Backend\Template\ModuleTemplate\icons(), TYPO3\CMS\Backend\Template\ModuleTemplate\sectionBegin(), and TYPO3\CMS\Backend\Template\ModuleTemplate\sectionHeader().

◆ sectionBegin()

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

Begins an output section. Returns the

-begin tag AND sets the ->sectionFlag TRUE (if the ->sectionFlag is not already set!) You can call this function even if a section is already begun since the function will only return something if the sectionFlag is not already set!
Returns
string HTML content

Definition at line 707 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\section(), and TYPO3\CMS\Backend\Template\ModuleTemplate\sectionHeader().

◆ sectionEnd()

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

Ends and output section Returns the -end tag AND clears the ->sectionFlag (but does so only IF the sectionFlag is set - that is a section is 'open') See sectionBegin() also.

Returns
string HTML content

Definition at line 732 of file ModuleTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\ModuleTemplate\divider(), and TYPO3\CMS\Backend\Template\ModuleTemplate\header().

◆ sectionHeader()

TYPO3\CMS\Backend\Template\ModuleTemplate::sectionHeader (   $label,
  $sH = false,
  $addAttribute = '' 
)

Make a section header. Begins a section if not already open.

Parameters
string$labelThe label between the

or tags. (Allows HTML) bool $sH If set, is used, otherwise string $addAttribute Additional attributes to h-tag, eg. ' class=""' string HTML content

Definition at line 682 of file ModuleTemplate.php.

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

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

◆ setBodyTag()

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

Sets the body tag

Parameters
string$bodyTag

Definition at line 201 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
Returns
void

Definition at line 222 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 876 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
Returns
void

Definition at line 391 of file ModuleTemplate.php.

◆ setJavaScriptCodeArray()

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

Wrapper function for adding JS inline blocks

Returns
void

Definition at line 313 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
Returns
void

Definition at line 403 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
Returns
void

Definition at line 416 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 232 of file ModuleTemplate.php.

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

◆ setUiBlock()

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

Definition at line 905 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)

Returns
void

Definition at line 299 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 81 of file ModuleTemplate.php.

◆ $layoutRootPaths

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

Definition at line 114 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 107 of file ModuleTemplate.php.

◆ $sectionFlag

TYPO3\CMS\Backend\Template\ModuleTemplate::$sectionFlag = 0
protected

Definition at line 142 of file ModuleTemplate.php.

◆ $templateFile

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

Definition at line 121 of file ModuleTemplate.php.

◆ $templateRootPaths

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

Definition at line 100 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 45 of file ModuleTemplate.php.

◆ STATUS_ICON_NOTIFICATION

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

Notification Icon Constant

Definition at line 59 of file ModuleTemplate.php.

◆ STATUS_ICON_OK

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

OK Icon Constant

Definition at line 66 of file ModuleTemplate.php.

◆ STATUS_ICON_WARNING

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

Warning Icon Constant

Definition at line 52 of file ModuleTemplate.php.