MediaWiki  1.34.0
VectorTemplate Class Reference

QuickTemplate subclass for Vector. More...

Inheritance diagram for VectorTemplate:
Collaboration diagram for VectorTemplate:

Public Member Functions

 execute ()
 Outputs the entire contents of the HTML page. 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...
Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemContains 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'

Parameters
array$optionsCan be used to affect the output of a link. Possible options are:
  • 'text-wrapper' key to specify a list of elements to wrap the text of a link in. This should be an array of arrays containing a 'tag' and optionally an 'attributes' key. If you only have one element you don't need to wrap it in another array. eg: To use ... in all links use [ 'text-wrapper' => [ 'tag' => 'span' ] ] for your options.
  • 'link-class' key can be used to specify additional classes to apply to all links.
  • 'link-fallback' can be used to specify a tag to use instead of "<a>" if there is no link. eg: If you specify 'link-fallback' => 'span' than any non-link will output a "<span>" instead of just text.
Returns
string
More...
 
 makeListItem ( $key, $item, $options=[])
 Generates a list item for a navigation, portlet, portal, sidebar...list
Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemArray 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

Returns
string
More...
 
- Public Member Functions inherited from BaseTemplate
 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...
 
 makeSearchButton ( $mode, $attrs=[])
 
 makeSearchInput ( $attrs=[])
 
 msg ( $str)
 
 msgWiki ( $str)
 
 printTrail ()
 Output getTrail. More...
 
- Public Member Functions inherited from QuickTemplate
 __construct (Config $config=null)
 
 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)
 

Public Attributes

$this html('userlangattributes') foreach( $this->getFooterLinks() as $category=> $links) foreach( $links as $link) $this html($link) $footericons = $this->getFooterIcons( 'icononly' )
 
 $langSelector = ''
 
case __pad3__ if(count( $this->data['personal_urls'])==0) $this msg('personaltools') $this html('userlangattributes') $notLoggedIn:
 
if(count( $footericons) > 0) foreach( $footerIcons as $icon) $params ['html-unported'] = ob_get_contents()
 
if(! $this->getSkin() ->getUser() ->isLoggedIn() &&User::groupHasPermission(' *', 'edit') $personalTools ) = $this->getPersonalTools()
 
 $templates = new TemplateParser( __DIR__ . '/templates' )
 
case __pad0__ if(count( $this->data['variant_urls'])==0) $variantLabel:
 
$this msg('namespaces') $this html('userlangattributes') foreach( $this->data['namespace_urls'] as $key=> $item) break
 
foreach( $this->data['variant_urls'] as $item) foreach( $this->data['variant_urls'] as $key=> $item) break
 
case __pad1__ if(count( $this->data['view_urls'])==0) $this msg('views') $this html('userlangattributes') foreach( $this->data['view_urls'] as $key=> $item) break:
 
case __pad2__ if(count( $this->data['action_urls'])==0) $this msg('vector-more-actions') $this html('userlangattributes') foreach( $this->data['action_urls'] as $key=> $item) break:
 
foreach( $personalTools as $key=> $item) break
 
 break
 
if(is_array( $content)) else
 
$this html ( 'userlangattributes')
 
 if (array_key_exists('uls', $personalTools))
 
case __pad4__ $this html('userlangattributes') $this msg('search') $this text ( 'wgScript'):
 
- Public Attributes inherited from QuickTemplate
array $data
 

Protected Member Functions

 renderNavigation (array $elements)
 Render one or more navigations elements by name, automatically reversed by css when UI is in RTL mode. More...
 
 renderPortal ( $name, $content, $msg=null, $hook=null)
 
 renderPortals (array $portals)
 Render a series of portals. More...
 
- Protected Member Functions inherited from BaseTemplate
 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

- Protected Attributes inherited from QuickTemplate
 $config
 

Detailed Description

QuickTemplate subclass for Vector.

Definition at line 29 of file VectorTemplate.php.

Member Function Documentation

◆ execute()

◆ makeLink()

VectorTemplate::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...

Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemContains 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'

Parameters
array$optionsCan be used to affect the output of a link. Possible options are:
  • 'text-wrapper' key to specify a list of elements to wrap the text of a link in. This should be an array of arrays containing a 'tag' and optionally an 'attributes' key. If you only have one element you don't need to wrap it in another array. eg: To use ... in all links use [ 'text-wrapper' => [ 'tag' => 'span' ] ] for your options.
  • 'link-class' key can be used to specify additional classes to apply to all links.
  • 'link-fallback' can be used to specify a tag to use instead of "<a>" if there is no link. eg: If you specify 'link-fallback' => 'span' than any non-link will output a "<span>" instead of just text.
Returns
string

Reimplemented from BaseTemplate.

Definition at line 450 of file VectorTemplate.php.

◆ makeListItem()

VectorTemplate::makeListItem (   $key,
  $item,
  $options = [] 
)

Generates a list item for a navigation, portlet, portal, sidebar...list

Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemArray 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

Returns
string

Reimplemented from BaseTemplate.

Definition at line 462 of file VectorTemplate.php.

◆ renderNavigation()

VectorTemplate::renderNavigation ( array  $elements)
protected

Render one or more navigations elements by name, automatically reversed by css when UI is in RTL mode.

Parameters
array$elements

Definition at line 268 of file VectorTemplate.php.

References html, and BaseTemplate\msg().

Referenced by execute().

◆ renderPortal()

VectorTemplate::renderPortal (   $name,
  $content,
  $msg = null,
  $hook = null 
)
protected
Parameters
string$name
array | string$content
null | string$msg
null | string | array$hook

Definition at line 217 of file VectorTemplate.php.

References BaseTemplate\getMsg(), and Linker\tooltip().

Referenced by renderPortals().

◆ renderPortals()

VectorTemplate::renderPortals ( array  $portals)
protected

Render a series of portals.

Parameters
array$portals

Definition at line 175 of file VectorTemplate.php.

References $content, BaseTemplate\getToolbox(), renderPortal(), and Hooks\run().

Referenced by execute().

Member Data Documentation

◆ $footericons

$this html ( 'userlangattributes' ) foreach ($this->getFooterLinks() as $category=> $links) foreach ($links as $link) $this html ( $link ) VectorTemplate::$footericons = $this->getFooterIcons( 'icononly' )

Definition at line 138 of file VectorTemplate.php.

◆ $langSelector

VectorTemplate::$langSelector = ''

Definition at line 389 of file VectorTemplate.php.

◆ $notLoggedIn

case __pad3__ if (count($this->data[ 'personal_urls'])==0) $this msg ( 'personaltools' ) $this html ( 'userlangattributes' ) VectorTemplate::$notLoggedIn = ''

Definition at line 375 of file VectorTemplate.php.

◆ $params

if (count($footericons) > 0) foreach ($footerIcons as $icon) VectorTemplate::$params[ 'html-unported'] = ob_get_contents()

Definition at line 162 of file VectorTemplate.php.

Referenced by execute().

◆ $personalTools

if (! $this->getSkin() ->getUser() ->isLoggedIn() &&User::groupHasPermission(' *', 'edit') VectorTemplate::$personalTools) = $this->getPersonalTools()

Definition at line 387 of file VectorTemplate.php.

◆ $templates

VectorTemplate::$templates = new TemplateParser( __DIR__ . '/templates' )

Definition at line 166 of file VectorTemplate.php.

◆ $variantLabel

case __pad0__ if (count($this->data[ 'variant_urls'])==0) VectorTemplate::$variantLabel = $this->getMsg( 'variants' )->text()

Definition at line 301 of file VectorTemplate.php.

◆ break [1/6]

$this msg ( 'namespaces' ) $this html ( 'userlangattributes' ) foreach ($this->data[ 'namespace_urls'] as $key=> $item) VectorTemplate::break

Definition at line 282 of file VectorTemplate.php.

◆ break [2/6]

foreach ($this->data[ 'variant_urls'] as $item) foreach ($this->data[ 'variant_urls'] as $key=> $item) VectorTemplate::break

Definition at line 315 of file VectorTemplate.php.

◆ break [3/6]

case __pad1__ if (count($this->data[ 'view_urls'])==0) $this msg ( 'views' ) $this html ( 'userlangattributes' ) foreach ($this->data[ 'view_urls'] as $key=> $item) VectorTemplate::break

Definition at line 333 of file VectorTemplate.php.

◆ break [4/6]

case __pad2__ if (count($this->data[ 'action_urls'])==0) $this msg ( 'vector-more-actions' ) $this html ( 'userlangattributes' ) foreach ($this->data[ 'action_urls'] as $key=> $item) VectorTemplate::break

Definition at line 357 of file VectorTemplate.php.

◆ break [5/6]

foreach ($personalTools as $key=> $item) VectorTemplate::break

Definition at line 397 of file VectorTemplate.php.

◆ break [6/6]

VectorTemplate::break

Definition at line 415 of file VectorTemplate.php.

◆ else

if (is_array($content)) VectorTemplate::else
Initial value:
{
echo $content

Definition at line 250 of file VectorTemplate.php.

◆ html

$this VectorTemplate::html('userlangattributes')

Definition at line 229 of file VectorTemplate.php.

Referenced by execute(), and renderNavigation().

◆ if

VectorTemplate::if(array_key_exists( 'uls', $personalTools))

Definition at line 390 of file VectorTemplate.php.

◆ text

case __pad4__ $this html ( 'userlangattributes' ) $this msg ( 'search' ) $this VectorTemplate::text('wgScript')

Definition at line 411 of file VectorTemplate.php.


The documentation for this class was generated from the following file:
$content
$content
Definition: router.php:78