‪TYPO3CMS  10.4
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 redirectUrls ($thisLocation='')
 
 useCompatibilityTag ($useCompatibilityTag=true)
 
string startPage ($title)
 
string endPage ()
 
string render ($title, $content)
 
string docBodyTagBegin ()
 
 docStyle ()
 
 addStyleSheetDirectory ($path)
 
string insertStylesAndJS ($content)
 
array getSkinStylesheetDirectories ()
 
string generator ()
 
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 = ''
 
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 ()
 
LanguageService null getLanguageService ()
 

Protected Attributes

string $moduleTemplateFilename = ''
 
bool $useCompatibilityTag = false
 
string $xUaCompatibilityVersion = 'IE=edge'
 
array $stylesheetsSkins
 
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.

Deprecated:
‪will be removed in TYPO3 v11.0. Use ModuleTemplate and PageRenderer instead.

Definition at line 53 of file DocumentTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ 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 545 of file DocumentTemplate.php.

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 508 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 516 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 466 of file DocumentTemplate.php.

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

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

◆ generator()

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

Returns generator meta tag

Returns
‪string HTML <meta> tag with name "generator"

Definition at line 616 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 880 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 730 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 715 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 634 of file DocumentTemplate.php.

References $GLOBALS.

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

◆ getLanguageService()

LanguageService null TYPO3\CMS\Backend\Template\DocumentTemplate::getLanguageService ( )
protected

◆ 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 774 of file DocumentTemplate.php.

References $GLOBALS, and TYPO3\CMS\Backend\Template\DocumentTemplate\getLanguageService().

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 579 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 859 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 251 of file DocumentTemplate.php.

References $GLOBALS, and TYPO3\CMS\Backend\Template\DocumentTemplate\getLanguageService().

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

Todo:

: Review this, it may be obsolete or could be done differently?

: Previous comment was: "This is needed for extobjbase" (AbstractFunctionModule)

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

Definition at line 563 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 283 of file DocumentTemplate.php.

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

◆ 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 324 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 665 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

Definition at line 341 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 494 of file DocumentTemplate.php.

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

◆ setModuleTemplate()

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

Define the template for the module

Parameters
string$filename‪filename

Definition at line 650 of file DocumentTemplate.php.

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

◆ startPage()

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

Returns page start This includes the proper header with charset, title, meta tag and beginning body-tag.

Parameters
string$title‪HTML Page title for the header
Returns
‪string Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
See also
endPage()

Definition at line 382 of file DocumentTemplate.php.

References $GLOBALS, TYPO3\CMS\Backend\Template\DocumentTemplate\$pageRenderer, TYPO3\CMS\Backend\Template\DocumentTemplate\docBodyTagBegin(), TYPO3\CMS\Backend\Template\DocumentTemplate\docStyle(), TYPO3\CMS\Backend\Template\DocumentTemplate\generator(), TYPO3\CMS\Backend\Template\DocumentTemplate\getBackendFavicon(), TYPO3\CMS\Backend\Template\DocumentTemplate\getBackendUser(), TYPO3\CMS\Core\Page\PageRenderer\PART_FOOTER, TYPO3\CMS\Core\Page\PageRenderer\PART_HEADER, and TYPO3\CMS\Backend\Template\DocumentTemplate\useCompatibilityTag().

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

◆ 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 363 of file DocumentTemplate.php.

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

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

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.

◆ $divClass

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

(Default) Class for wrapping

-tag of page. Is set in class extensions.

Definition at line 170 of file DocumentTemplate.php.

◆ $endOfPageJsBlock

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

Definition at line 178 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 63 of file DocumentTemplate.php.

◆ $iconFactory

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

Definition at line 198 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 accumulated in this var. It will be directly outputted in the header.

Definition at line 69 of file DocumentTemplate.php.

◆ $JScodeArray

array TYPO3\CMS\Backend\Template\DocumentTemplate::$JScodeArray
Initial value:
= array( 'jumpToUrl' => '
function jumpToUrl(URL) {
console.warn(\'jumpToUrl() has been marked as deprecated.\');
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 75 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 174 of file DocumentTemplate.php.

◆ $pageHeaderFooterTemplateFile

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

Alternative template file

Definition at line 188 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().

◆ $showFlashMessages

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

Whether flashmessages should be rendered or not

$showFlashMessages

Definition at line 194 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 202 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.