MediaWiki  master
BaseTemplate Class Reference

New base template for a skin's template extended from QuickTemplate this class features helper methods that provide common ways of interacting with the data stored in the QuickTemplate. More...

Inheritance diagram for BaseTemplate:
Collaboration diagram for BaseTemplate:

Public Member Functions

 getIndicators ()
 Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content. More...
 
 getMsg ( $name,... $params)
 Get a Message object with its context set. More...
 
 getPersonalTools ()
 
 getToolbox ()
 Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate and items added by hook to the 'toolbox' section. More...
 
 getTrail ()
 Get the basic end-page trail including bottomscripts, reporttime, and debug stuff. More...
 
 makeListItem ( $key, $item, $options=[])
 
 msg ( $str)
 
- Public Member Functions inherited from QuickTemplate
 __construct (Config $config=null)
 
 execute ()
 Main function, used by classes that subclass QuickTemplate to show the actual HTML output. More...
 
 extend ( $name, $value)
 extends the value of data with name $name with the value $value More...
 
 get ( $name, $default=null)
 Gets the template data requested. More...
 
 getHTML ()
 Fetch the output of a QuickTemplate and return it. More...
 
 getSkin ()
 Get the Skin object related to this object. More...
 
 html ( $str)
 
 set ( $name, $value)
 Sets the value $value to $name. More...
 

Protected Member Functions

 getAfterPortlet ( $name)
 Allows extensions to hook into known portlets and add stuff to them. More...
 
 getClear ()
 Get a div with the core visualClear class, for clearing floats. More...
 
 getFooter ( $iconStyle='icononly', $linkStyle='flat')
 Renderer for getFooterIcons and getFooterLinks. More...
 
 getFooterIcons ( $option=null)
 Returns an array of footer icons filtered down by options relevant to how the skin wishes to display them. More...
 
 getFooterLinks ( $option=null)
 Returns an array of footerlinks trimmed down to only those footer links that are valid. More...
 
 getSidebar ( $options=[])
 
 makeLink ( $key, $item, $options=[])
 
 makeSearchButton ( $mode, $attrs=[])
 
 makeSearchInput ( $attrs=[])
 
 printTrail ()
 Output getTrail. More...
 
 renderAfterPortlet ( $name)
 
- Protected Member Functions inherited from QuickTemplate
 haveMsg ( $msgKey)
 
 text ( $str)
 

Additional Inherited Members

- Public Attributes inherited from QuickTemplate
array $data
 
- Protected Attributes inherited from QuickTemplate
Config $config
 

Detailed Description

New base template for a skin's template extended from QuickTemplate this class features helper methods that provide common ways of interacting with the data stored in the QuickTemplate.

Stable to extend

Definition at line 31 of file BaseTemplate.php.

Member Function Documentation

◆ getAfterPortlet()

BaseTemplate::getAfterPortlet (   $name)
protected

Allows extensions to hook into known portlets and add stuff to them.

Deprecated:
since 1.35 use Skin::getAfterPortlet directly
Parameters
string$name
Returns
string html
Since
1.29

Definition at line 234 of file BaseTemplate.php.

References $content, QuickTemplate\getSkin(), and Html\rawElement().

Referenced by renderAfterPortlet().

◆ getClear()

BaseTemplate::getClear ( )
protected

Get a div with the core visualClear class, for clearing floats.

Returns
string html
Since
1.29

Definition at line 415 of file BaseTemplate.php.

References Html\element().

Referenced by getFooter().

◆ getFooter()

BaseTemplate::getFooter (   $iconStyle = 'icononly',
  $linkStyle = 'flat' 
)
protected

Renderer for getFooterIcons and getFooterLinks.

Parameters
string$iconStyle$option for getFooterIcons: "icononly", "nocopyright"
string$linkStyle$option for getFooterLinks: "flat"
Returns
string html
Since
1.29

Definition at line 364 of file BaseTemplate.php.

References Html\closeElement(), Sanitizer\escapeIdForAttribute(), getClear(), getFooterIcons(), getFooterLinks(), QuickTemplate\getSkin(), Html\openElement(), and Html\rawElement().

◆ getFooterIcons()

BaseTemplate::getFooterIcons (   $option = null)
protected

Returns an array of footer icons filtered down by options relevant to how the skin wishes to display them.

If you pass "icononly" as the option all footer icons which do not have an image icon set will be filtered out. If you pass "nocopyright" then MediaWiki's copyright icon will not be included in the list of footer icons. This is mostly useful for skins which only display the text from footericons instead of the images and don't want a duplicate copyright statement because footerlinks already rendered one.

Parameters
string | null$option
Deprecated:
1.35 read footer icons from template data requested via $this->get('footericons')
Returns
array

Definition at line 329 of file BaseTemplate.php.

Referenced by getFooter().

◆ getFooterLinks()

BaseTemplate::getFooterLinks (   $option = null)
protected

Returns an array of footerlinks trimmed down to only those footer links that are valid.

If you pass "flat" as an option then the returned array will be a flat array of footer icons instead of a key/value array of footerlinks arrays broken up into categories.

Parameters
string | null$option
Returns
array|mixed

Definition at line 290 of file BaseTemplate.php.

Referenced by getFooter().

◆ getIndicators()

BaseTemplate::getIndicators ( )

Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content.

Your skin may implement this differently, for example by handling some indicator names specially with a different UI. However, it is recommended to use a <div class="mw-indicator" id="mw-indicator-<id>" /> as a wrapper element for each indicator, for better compatibility with extensions and user scripts.

The raw data is available in ‘$this->data['indicators’]` as an associative array (keys: identifiers, values: contents) internally ordered by keys.

Returns
string HTML
Since
1.25

Definition at line 434 of file BaseTemplate.php.

References $content, Sanitizer\escapeIdForAttribute(), and Html\rawElement().

◆ getMsg()

BaseTemplate::getMsg (   $name,
  $params 
)

Get a Message object with its context set.

Parameters
string$nameMessage name
mixed...$params Message params
Returns
Message

Definition at line 40 of file BaseTemplate.php.

References QuickTemplate\getSkin().

Referenced by getSidebar(), and msg().

◆ getPersonalTools()

BaseTemplate::getPersonalTools ( )
Deprecated:
since 1.35 use Skin::getPersonalToolsForMakeListItem
Returns
array

Definition at line 81 of file BaseTemplate.php.

References QuickTemplate\getSkin().

◆ getSidebar()

BaseTemplate::getSidebar (   $options = [])
protected
Parameters
array$options(optional) allows disabling certain sidebar elements. The keys search, toolbox and languages are accepted.
Returns
array representing the sidebar

Definition at line 90 of file BaseTemplate.php.

References $content, getMsg(), and QuickTemplate\getSkin().

◆ getToolbox()

BaseTemplate::getToolbox ( )

Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate and items added by hook to the 'toolbox' section.

The resulting array is built according to a format intended to be passed through makeListItem to generate the html.

Deprecated:
since 1.35. To add items to the toolbox, use SidebarBeforeOutput hook. To get the toolbox only use $this->data['sidebar']['TOOLBOX'], if you are extending this class.
Returns
array

Definition at line 59 of file BaseTemplate.php.

References QuickTemplate\getSkin(), and wfDeprecated().

◆ getTrail()

BaseTemplate::getTrail ( )

Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.

This should be called right before outputting the closing body and html tags.

Returns
string|WrappedStringList HTML
Since
1.29

Definition at line 465 of file BaseTemplate.php.

References getContext(), MWDebug\getDebugHTML(), and QuickTemplate\getSkin().

Referenced by printTrail().

◆ makeLink()

BaseTemplate::makeLink (   $key,
  $item,
  $options = [] 
)
protected
Deprecated:
since 1.35 use Skin::makeLink
Returns
string

Definition at line 255 of file BaseTemplate.php.

References QuickTemplate\getSkin().

◆ makeListItem()

BaseTemplate::makeListItem (   $key,
  $item,
  $options = [] 
)
Deprecated:
since 1.35 use Skin::makeListItem
Returns
string

Definition at line 263 of file BaseTemplate.php.

References QuickTemplate\getSkin().

◆ makeSearchButton()

BaseTemplate::makeSearchButton (   $mode,
  $attrs = [] 
)
protected
Deprecated:
since 1.35 use Skin::makeSearchButton

Definition at line 277 of file BaseTemplate.php.

References QuickTemplate\getSkin().

◆ makeSearchInput()

BaseTemplate::makeSearchInput (   $attrs = [])
protected
Deprecated:
since 1.35 use Skin::makeSearchInput

Definition at line 270 of file BaseTemplate.php.

References QuickTemplate\getSkin().

◆ msg()

BaseTemplate::msg (   $msgKey)
Parameters
string$msgKey

Reimplemented from QuickTemplate.

Definition at line 44 of file BaseTemplate.php.

References getMsg().

◆ printTrail()

BaseTemplate::printTrail ( )
protected

Output getTrail.

Definition at line 453 of file BaseTemplate.php.

References getTrail().

◆ renderAfterPortlet()

BaseTemplate::renderAfterPortlet (   $name)
protected
Deprecated:
since 1.35 use Skin::getAfterPortlet directly
Parameters
string$name

Definition at line 220 of file BaseTemplate.php.

References getAfterPortlet().


The documentation for this class was generated from the following file: