MediaWiki
1.34.0
|
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...
Public Member Functions | |
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... | |
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 () | |
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate. More... | |
getSidebar ( $options=[]) | |
getToolbox () | |
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate. More... | |
getTrail () | |
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff. More... | |
makeLink ( $key, $item, $options=[]) | |
Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigation lists, portlets, portals, sidebars, etc... More... | |
makeListItem ( $key, $item, $options=[]) | |
Generates a list item for a navigation, portlet, portal, sidebar... More... | |
makeSearchButton ( $mode, $attrs=[]) | |
makeSearchInput ( $attrs=[]) | |
msg ( $str) | |
msgWiki ( $str) | |
printTrail () | |
Output getTrail. More... | |
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... | |
haveData ( $str) | |
haveMsg ( $msgKey) | |
html ( $str) | |
set ( $name, $value) | |
Sets the value $value to $name. More... | |
setRef ( $name, &$value) | |
text ( $str) | |
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... | |
renderAfterPortlet ( $name) | |
Additional Inherited Members | |
Public Attributes inherited from QuickTemplate | |
array | $data |
Protected Attributes inherited from QuickTemplate | |
$config | |
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.
Definition at line 29 of file BaseTemplate.php.
|
protected |
Allows extensions to hook into known portlets and add stuff to them.
string | $name |
Definition at line 295 of file BaseTemplate.php.
References $content, and Hooks\run().
Referenced by TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), and renderAfterPortlet().
|
protected |
Get a div with the core visualClear class, for clearing floats.
Definition at line 706 of file BaseTemplate.php.
Referenced by TimelessTemplate\execute(), MonoBookTemplate\execute(), TimelessTemplate\getContentBlock(), and getFooter().
|
protected |
Renderer for getFooterIcons and getFooterLinks.
string | $iconStyle | $option for getFooterIcons: "icononly", "nocopyright" |
string | $linkStyle | $option for getFooterLinks: "flat" |
Definition at line 656 of file BaseTemplate.php.
References getClear(), getFooterIcons(), getFooterLinks(), and QuickTemplate\getSkin().
Referenced by TimelessTemplate\execute().
BaseTemplate::getFooterIcons | ( | $option = null | ) |
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.
string | null | $option |
Definition at line 618 of file BaseTemplate.php.
Referenced by getFooter(), and MonoBookTemplate\getSimpleFooter().
BaseTemplate::getFooterLinks | ( | $option = null | ) |
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.
string | null | $option |
Definition at line 581 of file BaseTemplate.php.
Referenced by VectorTemplate\execute(), getFooter(), and MonoBookTemplate\getSimpleFooter().
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.
Definition at line 725 of file BaseTemplate.php.
References $content.
Referenced by VectorTemplate\execute(), MonoBookTemplate\execute(), and TimelessTemplate\getContentBlock().
BaseTemplate::getMsg | ( | $name, | |
$params | |||
) |
Get a Message object with its context set.
Definition at line 38 of file BaseTemplate.php.
References QuickTemplate\getSkin().
Referenced by SkinFallbackTemplate\buildHelpfulInformationMessage(), VectorTemplate\execute(), MonoBookTemplate\execute(), MonoBookTemplate\getBox(), MonoBookTemplate\getCactions(), TimelessTemplate\getContentBlock(), TimelessTemplate\getLogo(), TimelessTemplate\getLogoImage(), TimelessTemplate\getPageTools(), TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), TimelessTemplate\getSearch(), MonoBookTemplate\getSearchBox(), getSidebar(), TimelessTemplate\getSidebarChunk(), TimelessTemplate\getUserLinks(), msg(), msgWiki(), and VectorTemplate\renderPortal().
BaseTemplate::getPersonalTools | ( | ) |
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
The resulting array is built according to a format intended to be passed through makeListItem to generate the html. This is in reality the same list as already stored in personal_urls however it is reformatted so that you can just pass the individual items to makeListItem instead of hardcoding the element creation boilerplate.
Reimplemented in SkinApiTemplate.
Definition at line 127 of file BaseTemplate.php.
Referenced by MonoBookTemplate\execute(), and TimelessTemplate\getUserLinks().
BaseTemplate::getSidebar | ( | $options = [] | ) |
Reimplemented in SkinApiTemplate.
Definition at line 152 of file BaseTemplate.php.
References $content, getMsg(), getToolbox(), makeListItem(), and Hooks\run().
Referenced by TimelessTemplate\execute().
BaseTemplate::getToolbox | ( | ) |
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
The resulting array is built according to a format intended to be passed through makeListItem to generate the html.
Reimplemented in SkinApiTemplate.
Definition at line 61 of file BaseTemplate.php.
References Hooks\run().
Referenced by TimelessTemplate\getPageTools(), getSidebar(), MonoBookTemplate\getToolboxBox(), and VectorTemplate\renderPortals().
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.
Definition at line 756 of file BaseTemplate.php.
References getContext(), MWDebug\getDebugHTML(), and QuickTemplate\getSkin().
Referenced by VectorTemplate\execute(), MonoBookTemplate\execute(), and printTrail().
BaseTemplate::makeLink | ( | $key, | |
$item, | |||
$options = [] |
|||
) |
Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigation lists, portlets, portals, sidebars, etc...
string | $key | Usually a key from the list you are generating this link from. |
array | $item | Contains some of a specific set of keys. |
The text of the link will be generated either from the contents of the "text" key in the $item array, if a "msg" key is present a message by that name will be used, and if neither of those are set the $key will be used as a message name.
If a "href" key is not present makeLink will just output htmlescaped text. The "href", "id", "class", "rel", and "type" keys are used as attributes for the link if present.
If an "id" or "single-id" (if you don't want the actual id to be output on the link) is present it will be used to generate a tooltip and accesskey for the link.
The keys "context" and "primary" are ignored; these keys are used internally by skins and are not supposed to be included in the HTML output.
If you don't want an accesskey, set $item['tooltiponly'] = true;
If a "data" key is present, it must be an array, where the keys represent the data-xxx properties with their provided values. For example, $item['data'] = [ 'foo' => 1, 'bar' => 'baz', ]; will render as element properties: data-foo='1' data-bar='baz'
array | $options | Can be used to affect the output of a link. Possible options are:
|
Reimplemented in VectorTemplate.
Definition at line 363 of file BaseTemplate.php.
References $title, Linker\titleAttrib(), Linker\tooltipAndAccesskeyAttribs(), and wfMessage().
Referenced by makeListItem().
BaseTemplate::makeListItem | ( | $key, | |
$item, | |||
$options = [] |
|||
) |
Generates a list item for a navigation, portlet, portal, sidebar...
list
string | $key | Usually a key from the list you are generating this link from. |
array | $item | Array of list item data containing some of a specific set of keys. The "id", "class" and "itemtitle" keys will be used as attributes for the list item, if "active" contains a value of true a "active" class will also be appended to class. -param array{id?:string,class?:string,itemtitle?:string,active?:bool} $item |
array | $options | -param array{tag?:string} $options |
If you want something other than a "<li>" you can pass a tag name such as "tag" => "span" in the $options array to change the tag used. link/content data for the list item may come in one of two forms A "links" key may be used, in which case it should contain an array with a list of links to include inside the list item, see makeLink for the format of individual links array items.
Otherwise the relevant keys from the list item $item array will be passed to makeLink instead. Note however that "id" and "class" are used by the list item directly so they will not be passed to makeLink (however the link will still support a tooltip and accesskey from it) If you need an id or class on a single link you should include a "links" array with just one link item inside of it. You can also set "link-class" in $item to set a class on the link itself. If you want to add a title to the list item itself, you can set "itemtitle" to the value. $options is also passed on to makeLink calls
Reimplemented in VectorTemplate.
Definition at line 470 of file BaseTemplate.php.
References makeLink().
Referenced by MonoBookTemplate\getBox(), TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), getSidebar(), and TimelessTemplate\getUserLinks().
BaseTemplate::makeSearchButton | ( | $mode, | |
$attrs = [] |
|||
) |
Definition at line 531 of file BaseTemplate.php.
References Linker\tooltipAndAccesskeyAttribs(), and wfMessage().
Referenced by SkinFallbackTemplate\execute(), TimelessTemplate\getSearch(), and MonoBookTemplate\getSearchBox().
BaseTemplate::makeSearchInput | ( | $attrs = [] | ) |
Definition at line 521 of file BaseTemplate.php.
References Linker\tooltipAndAccesskeyAttribs(), and wfMessage().
Referenced by SkinFallbackTemplate\execute(), TimelessTemplate\getSearch(), and MonoBookTemplate\getSearchBox().
BaseTemplate::msg | ( | $msgKey | ) |
string | $msgKey |
Reimplemented from QuickTemplate.
Definition at line 42 of file BaseTemplate.php.
References getMsg().
Referenced by VectorTemplate\execute(), SkinFallbackTemplate\execute(), and VectorTemplate\renderNavigation().
BaseTemplate::msgWiki | ( | $str | ) |
Reimplemented from QuickTemplate.
Definition at line 49 of file BaseTemplate.php.
References getMsg(), and wfDeprecated().
BaseTemplate::printTrail | ( | ) |
Output getTrail.
Definition at line 744 of file BaseTemplate.php.
References getTrail().
Referenced by SkinApiTemplate\execute(), and SkinFallbackTemplate\execute().
|
protected |
string | $name |
Definition at line 283 of file BaseTemplate.php.
References getAfterPortlet().