‪TYPO3CMS  9.5
TYPO3\CMS\Backend\Template\DocumentTemplate Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Template\DocumentTemplate:

Public Member Functions

 __construct ()
 
string makeShortcutIcon ($gvList, $setList, $modName, $motherModName='', $classes='')
 
string makeShortcutUrl ($gvList, $setList)
 
string formWidth ($size=48, $textarea=false, $styleOverride='')
 
string redirectUrls ($thisLocation='')
 
 useCompatibilityTag ($useCompatibilityTag=true)
 
string startPage ($title)
 
string endPage ()
 
string render ($title, $content)
 
string docBodyTagBegin ()
 
 docStyle ()
 
 addStyleSheet ($key, $href, $title='', $relation='stylesheet')
 
 addStyleSheetDirectory ($path)
 
string insertStylesAndJS ($content)
 
array getSkinStylesheetDirectories ()
 
string generator ()
 
string xUaCompatible ($content='IE=8')
 
string getHtmlTemplate ($filename)
 
 setModuleTemplate ($filename)
 
string moduleBody ($pageRecord=[], $buttons=[], $markerArray=[], $subpartArray=[])
 
string getFlashMessages ()
 

Public Attributes

string $form = ''
 
string $JScode = ''
 
array $JScodeArray
 
string $postCode = ''
 
string $moduleTemplate = ''
 
string $scriptID = ''
 
string $bodyTagId = ''
 
string $bodyTagAdditions = ''
 
array $inDocStylesArray = array( )
 
string $styleSheetFile = ''
 
string $styleSheetFile2 = ''
 
string $styleSheetFile_post = ''
 
int $sectionFlag = 0
 
string $divClass = ''
 
string $pageHeaderBlock = ''
 
string $endOfPageJsBlock = ''
 
bool $showFlashMessages = true
 

Protected Member Functions

 initPageRenderer ()
 
array getDocHeaderButtons ($buttons)
 
string getPagePath ($pageRecord)
 
string getPageInfo ($pageRecord)
 
string getBackendFavicon ()
 
string getUriForFileName ($filename)
 
BackendUserAuthentication null getBackendUser ()
 

Protected Attributes

array $deprecatedPublicProperties
 
string $moduleTemplateFilename = ''
 
bool $useCompatibilityTag = false
 
string $xUaCompatibilityVersion = 'IE=edge'
 
array $stylesheetsSkins
 
array $jsFiles = array( )
 
array $jsFilesNoConcatenation = array( )
 
bool $hasDocheader = true
 
PageRenderer $pageRenderer
 
string $pageHeaderFooterTemplateFile = ''
 
IconFactory $iconFactory
 
MarkerBasedTemplateService $templateService
 

Detailed Description

TYPO3 Backend Template Class

This class contains functions for starting and ending the HTML of backend modules It also contains methods for outputting sections of content. Further there are functions for making icons, links, setting form-field widths etc. Color scheme and stylesheet definitions are also available here. Finally this file includes the language class for TYPO3's backend.

After this file $LANG and $TBE_TEMPLATE are global variables / instances of their respective classes.

Please refer to Inside TYPO3 for a discussion of how to use this API.

Definition at line 47 of file DocumentTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addStyleSheet()

TYPO3\CMS\Backend\Template\DocumentTemplate::addStyleSheet (   $key,
  $href,
  $title = '',
  $relation = 'stylesheet' 
)

Insert additional style sheet link

Parameters
string$key‪some key identifying the style sheet
string$href‪uri to the style sheet file
string$title‪value for the title attribute of the link element
string$relation‪value for the rel attribute of the link element
Deprecated:
‪since TYPO3 v9.4, will be removed in TYPO3 v10.0
See also
PageRenderer::addCssFile()

Definition at line 615 of file DocumentTemplate.php.

◆ addStyleSheetDirectory()

TYPO3\CMS\Backend\Template\DocumentTemplate::addStyleSheetDirectory (   $path)

Add all *.css files of the directory $path to the stylesheets

Parameters
string$path‪directory to add

Definition at line 626 of file DocumentTemplate.php.

References TYPO3\CMS\Core\Utility\PathUtility\getRelativePathTo().

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

◆ docBodyTagBegin()

string TYPO3\CMS\Backend\Template\DocumentTemplate::docBodyTagBegin ( )

Creates the bodyTag. You can add to the bodyTag by $this->bodyTagAdditions

Returns
‪string HTML body tag

Definition at line 573 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

◆ docStyle()

TYPO3\CMS\Backend\Template\DocumentTemplate::docStyle ( )

Outputting document style

Definition at line 581 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

◆ endPage()

string TYPO3\CMS\Backend\Template\DocumentTemplate::endPage ( )

Returns page end; This includes finishing form, div, body and html tags.

Returns
‪string The HTML end of a page
See also
startPage()

Definition at line 531 of file DocumentTemplate.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getUpdateSignalCode().

Referenced by TYPO3\CMS\Backend\Controller\LoginController\createLoginLogoutForm(), and TYPO3\CMS\Backend\Template\DocumentTemplate\render().

◆ formWidth()

string TYPO3\CMS\Backend\Template\DocumentTemplate::formWidth (   $size = 48,
  $textarea = false,
  $styleOverride = '' 
)

Returns <input> attributes to set the width of an text-type input field. For client browsers with no CSS support the cols/size attribute is returned. For CSS compliant browsers (recommended) a ' style="width: ...px;"' is returned.

Parameters
int$size‪A relative number which multiplied with approx. 10 will lead to the width in pixels
bool$textarea‪A flag you can set for textareas - DEPRECATED as there is no difference any more between the two
string$styleOverride‪A string which will be returned as attribute-value for style="" instead of the calculated width (if CSS is enabled)
Returns
‪string Tag attributes for an <input> tag (regarding width)
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0.

Definition at line 392 of file DocumentTemplate.php.

◆ generator()

string TYPO3\CMS\Backend\Template\DocumentTemplate::generator ( )

Returns generator meta tag

Returns
‪string <meta> tag with name "generator

Definition at line 696 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

◆ getBackendFavicon()

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

◆ getBackendUser()

BackendUserAuthentication null TYPO3\CMS\Backend\Template\DocumentTemplate::getBackendUser ( )
protected
Returns
‪BackendUserAuthentication|null

Definition at line 974 of file DocumentTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

◆ getDocHeaderButtons()

array TYPO3\CMS\Backend\Template\DocumentTemplate::getDocHeaderButtons (   $buttons)
protected

Fill the button lists with the defined HTML

Parameters
array$buttons‪HTML for all buttons
Returns
‪array Containing HTML for both buttonlists

Definition at line 824 of file DocumentTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\moduleBody().

◆ getFlashMessages()

string TYPO3\CMS\Backend\Template\DocumentTemplate::getFlashMessages ( )

Get the default rendered FlashMessages from queue

Returns
‪string

Definition at line 809 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\moduleBody().

◆ getHtmlTemplate()

string TYPO3\CMS\Backend\Template\DocumentTemplate::getHtmlTemplate (   $filename)

Function to load a HTML template file with markers. When calling from own extension, use syntax getHtmlTemplate('EXT:extkey/template.html')

Parameters
string$filename‪tmpl name, usually in the typo3/template/ directory
Returns
‪string HTML of template

Definition at line 728 of file DocumentTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\setModuleTemplate().

◆ getPageInfo()

string TYPO3\CMS\Backend\Template\DocumentTemplate::getPageInfo (   $pageRecord)
protected

◆ getPagePath()

string TYPO3\CMS\Backend\Template\DocumentTemplate::getPagePath (   $pageRecord)
protected

Generate the page path for docheader

Parameters
array$pageRecord‪Current page
Returns
‪string Page path

Definition at line 868 of file DocumentTemplate.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\moduleBody().

◆ getSkinStylesheetDirectories()

array TYPO3\CMS\Backend\Template\DocumentTemplate::getSkinStylesheetDirectories ( )

Returns an array of all stylesheet directories belonging to core and skins

Returns
‪array Stylesheet directories

Definition at line 659 of file DocumentTemplate.php.

References $GLOBALS, TYPO3\CMS\Backend\Template\DocumentTemplate\$stylesheetsSkins, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded().

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

◆ getUriForFileName()

string TYPO3\CMS\Backend\Template\DocumentTemplate::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 953 of file DocumentTemplate.php.

References TYPO3\CMS\Core\Utility\PathUtility\getAbsoluteWebPath().

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

◆ initPageRenderer()

TYPO3\CMS\Backend\Template\DocumentTemplate::initPageRenderer ( )
protected

Initializes the page renderer object

Definition at line 275 of file DocumentTemplate.php.

References $GLOBALS.

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

◆ insertStylesAndJS()

string TYPO3\CMS\Backend\Template\DocumentTemplate::insertStylesAndJS (   $content)

Insert post rendering document style into already rendered content This is needed for extobjbase

Parameters
string$content‪style-content to insert.
Returns
‪string content with inserted styles

Definition at line 643 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\render().

◆ makeShortcutIcon()

string TYPO3\CMS\Backend\Template\DocumentTemplate::makeShortcutIcon (   $gvList,
  $setList,
  $modName,
  $motherModName = '',
  $classes = '' 
)

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$classes
Returns
‪string HTML content

Definition at line 323 of file DocumentTemplate.php.

References $GLOBALS, TYPO3\CMS\Backend\Template\DocumentTemplate\makeShortcutUrl(), and TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

Referenced by TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\getButtons().

◆ makeShortcutUrl()

string TYPO3\CMS\Backend\Template\DocumentTemplate::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
See also
makeShortcutIcon()

Definition at line 371 of file DocumentTemplate.php.

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

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

◆ moduleBody()

string TYPO3\CMS\Backend\Template\DocumentTemplate::moduleBody (   $pageRecord = [],
  $buttons = [],
  $markerArray = [],
  $subpartArray = [] 
)

Put together the various elements for the module <body> using a static HTML template

Parameters
array$pageRecord‪Record of the current page, used for page path and info
array$buttons‪HTML for all buttons
array$markerArray‪HTML for all other markers
array$subpartArray‪HTML for the subparts
Returns
‪string Composite HTML

Definition at line 759 of file DocumentTemplate.php.

References $GLOBALS, TYPO3\CMS\Backend\Template\DocumentTemplate\$moduleTemplate, TYPO3\CMS\Backend\Template\DocumentTemplate\$moduleTemplateFilename, TYPO3\CMS\Backend\Template\DocumentTemplate\getDocHeaderButtons(), TYPO3\CMS\Backend\Template\DocumentTemplate\getFlashMessages(), TYPO3\CMS\Backend\Template\DocumentTemplate\getPageInfo(), and TYPO3\CMS\Backend\Template\DocumentTemplate\getPagePath().

◆ redirectUrls()

string TYPO3\CMS\Backend\Template\DocumentTemplate::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$thisLocation‪URL 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 406 of file DocumentTemplate.php.

◆ render()

string TYPO3\CMS\Backend\Template\DocumentTemplate::render (   $title,
  $content 
)

Shortcut for render the complete page of a module

Parameters
string$title‪page title
string$content‪page content
Returns
‪string complete page

Definition at line 559 of file DocumentTemplate.php.

References TYPO3\CMS\Backend\Template\DocumentTemplate\endPage(), TYPO3\CMS\Backend\Template\DocumentTemplate\insertStylesAndJS(), and TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

Referenced by TYPO3\CMS\Backend\Controller\BackendController\render().

◆ setModuleTemplate()

TYPO3\CMS\Backend\Template\DocumentTemplate::setModuleTemplate (   $filename)

Define the template for the module

Parameters
string$filename‪filename

Definition at line 744 of file DocumentTemplate.php.

References TYPO3\CMS\Backend\Template\DocumentTemplate\getHtmlTemplate().

◆ startPage()

string TYPO3\CMS\Backend\Template\DocumentTemplate::startPage (   $title)

◆ useCompatibilityTag()

TYPO3\CMS\Backend\Template\DocumentTemplate::useCompatibilityTag (   $useCompatibilityTag = true)

Defines whether to use the X-UA-Compatible meta tag.

Parameters
bool$useCompatibilityTag‪Whether to use the tag

Definition at line 426 of file DocumentTemplate.php.

References TYPO3\CMS\Backend\Template\DocumentTemplate\$useCompatibilityTag.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\startPage().

◆ xUaCompatible()

string TYPO3\CMS\Backend\Template\DocumentTemplate::xUaCompatible (   $content = 'IE=8')

Returns X-UA-Compatible meta tag

Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0.
Parameters
string$content‪Content of the compatible tag (default: IE-8)
Returns
‪string <meta http-equiv="X-UA-Compatible" content="???" >

Definition at line 708 of file DocumentTemplate.php.

Member Data Documentation

◆ $bodyTagAdditions

string TYPO3\CMS\Backend\Template\DocumentTemplate::$bodyTagAdditions = ''

You can add additional attributes to the body-tag through this variable.

Definition at line 117 of file DocumentTemplate.php.

◆ $bodyTagId

string TYPO3\CMS\Backend\Template\DocumentTemplate::$bodyTagId = ''

Id which can be set for the body tag. Default value is based on script ID

Definition at line 111 of file DocumentTemplate.php.

◆ $deprecatedPublicProperties

array TYPO3\CMS\Backend\Template\DocumentTemplate::$deprecatedPublicProperties
protected
Initial value:
= array(
'hasDocheader' => 'Using $hasDocheader of class DocumentTemplate is discouraged. The property is not evaluated in the TYPO3 core anymore and will be removed in TYPO3 v10.0.'
)

Definition at line 54 of file DocumentTemplate.php.

◆ $divClass

string TYPO3\CMS\Backend\Template\DocumentTemplate::$divClass = ''

(Default) Class for wrapping

-tag of page. Is set in class extensions.

Definition at line 189 of file DocumentTemplate.php.

◆ $endOfPageJsBlock

string TYPO3\CMS\Backend\Template\DocumentTemplate::$endOfPageJsBlock = ''

Definition at line 197 of file DocumentTemplate.php.

◆ $form

string TYPO3\CMS\Backend\Template\DocumentTemplate::$form = ''

This can be set to the HTML-code for a formtag. Useful when you need a form to span the whole page; Inserted exactly after the body-tag.

Definition at line 64 of file DocumentTemplate.php.

◆ $hasDocheader

bool TYPO3\CMS\Backend\Template\DocumentTemplate::$hasDocheader = true
protected
Deprecated:
‪since TYPO3 v9.4, will be removed in TYPO3 v10.0

Definition at line 202 of file DocumentTemplate.php.

◆ $iconFactory

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

Definition at line 222 of file DocumentTemplate.php.

◆ $inDocStylesArray

array TYPO3\CMS\Backend\Template\DocumentTemplate::$inDocStylesArray = array( )

Additional CSS styles which will be added to the <style> section in the header used as array with associative keys to prevent double inclusion of CSS code

Definition at line 124 of file DocumentTemplate.php.

◆ $JScode

string TYPO3\CMS\Backend\Template\DocumentTemplate::$JScode = ''

Additional header code (eg. a JavaScript section) could be accommulated in this var. It will be directly outputted in the header.

Definition at line 70 of file DocumentTemplate.php.

◆ $JScodeArray

array TYPO3\CMS\Backend\Template\DocumentTemplate::$JScodeArray
Initial value:
= array( 'jumpToUrl' => '
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
' )

Similar to $JScode but for use as array with associative keys to prevent double inclusion of JS code. a <script> tag is automatically wrapped around.

Definition at line 76 of file DocumentTemplate.php.

◆ $jsFiles

array TYPO3\CMS\Backend\Template\DocumentTemplate::$jsFiles = array( )
protected

JavaScript files loaded for every page in the Backend

Definition at line 170 of file DocumentTemplate.php.

◆ $jsFilesNoConcatenation

array TYPO3\CMS\Backend\Template\DocumentTemplate::$jsFilesNoConcatenation = array( )
protected

JavaScript files loaded for every page in the Backend, but explicitly excluded from concatenation (useful for libraries etc.)

Definition at line 176 of file DocumentTemplate.php.

◆ $moduleTemplate

string TYPO3\CMS\Backend\Template\DocumentTemplate::$moduleTemplate = ''

HTML template with markers for module

Definition at line 93 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\moduleBody().

◆ $moduleTemplateFilename

string TYPO3\CMS\Backend\Template\DocumentTemplate::$moduleTemplateFilename = ''
protected

The base file (not overlaid by TBE_STYLES) for the current module, useful for hooks when finding out which modules is rendered currently

Definition at line 99 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\moduleBody().

◆ $pageHeaderBlock

string TYPO3\CMS\Backend\Template\DocumentTemplate::$pageHeaderBlock = ''

Definition at line 193 of file DocumentTemplate.php.

◆ $pageHeaderFooterTemplateFile

string TYPO3\CMS\Backend\Template\DocumentTemplate::$pageHeaderFooterTemplateFile = ''
protected

Alternative template file

Definition at line 212 of file DocumentTemplate.php.

◆ $pageRenderer

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

◆ $postCode

string TYPO3\CMS\Backend\Template\DocumentTemplate::$postCode = ''

Additional 'page-end' code could be accumulated in this var. It will be outputted at the end of page before </body> and some other internal page-end code.

Definition at line 87 of file DocumentTemplate.php.

◆ $scriptID

string TYPO3\CMS\Backend\Template\DocumentTemplate::$scriptID = ''

Script ID

Definition at line 105 of file DocumentTemplate.php.

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

◆ $sectionFlag

int TYPO3\CMS\Backend\Template\DocumentTemplate::$sectionFlag = 0

Indicates if a

-output section is open
will be removed in TYPO3 v9

Definition at line 183 of file DocumentTemplate.php.

◆ $showFlashMessages

bool TYPO3\CMS\Backend\Template\DocumentTemplate::$showFlashMessages = true

Whether flashmessages should be rendered or not

$showFlashMessages

Definition at line 218 of file DocumentTemplate.php.

◆ $styleSheetFile

string TYPO3\CMS\Backend\Template\DocumentTemplate::$styleSheetFile = ''

Filename of stylesheet

Definition at line 130 of file DocumentTemplate.php.

◆ $styleSheetFile2

string TYPO3\CMS\Backend\Template\DocumentTemplate::$styleSheetFile2 = ''

Filename of stylesheet #2 - linked to right after the $this->styleSheetFile script

Definition at line 136 of file DocumentTemplate.php.

◆ $styleSheetFile_post

string TYPO3\CMS\Backend\Template\DocumentTemplate::$styleSheetFile_post = ''

Filename of a post-stylesheet - included right after all inline styles.

Definition at line 142 of file DocumentTemplate.php.

◆ $stylesheetsSkins

array TYPO3\CMS\Backend\Template\DocumentTemplate::$stylesheetsSkins
protected
Initial value:
= array(
'structure' => 'Resources/Public/Css/structure/',
'visual' => 'Resources/Public/Css/visual/'
)

Include these CSS directories from skins by default

Definition at line 161 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\getSkinStylesheetDirectories().

◆ $templateService

MarkerBasedTemplateService TYPO3\CMS\Backend\Template\DocumentTemplate::$templateService
protected

Definition at line 226 of file DocumentTemplate.php.

◆ $useCompatibilityTag

bool TYPO3\CMS\Backend\Template\DocumentTemplate::$useCompatibilityTag = false
protected

Whether to use the X-UA-Compatible meta tag

Definition at line 148 of file DocumentTemplate.php.

Referenced by TYPO3\CMS\Backend\Template\DocumentTemplate\useCompatibilityTag().

◆ $xUaCompatibilityVersion

string TYPO3\CMS\Backend\Template\DocumentTemplate::$xUaCompatibilityVersion = 'IE=edge'
protected

X-Ua-Compatible version output in meta tag

Definition at line 154 of file DocumentTemplate.php.