Go to the documentation of this file.
40 $html = $this->
get(
'headelement' );
44 $html .=
Html::rawElement(
'div', [
'id' =>
'content',
'class' =>
'mw-body',
'role' =>
'main' ],
48 'parameters' => [
'id' =>
'siteNotice',
'class' =>
'mw-body-content' ]
55 'id' =>
'firstHeading',
56 'class' =>
'firstHeading',
57 'lang' => $this->
getSkin()->
getTitle()->getPageViewLanguage()->getHtmlCode()
60 Html::rawElement(
'div', [
'id' =>
'bodyContent',
'class' =>
'mw-body-content' ],
64 [
'id' =>
'contentSub',
'lang' => $this->
get(
'userlang' ),
'dir' => $this->
get(
'dir' ) ],
65 $this->
get(
'subtitle' )
67 $this->
getIfExists(
'undelete', [
'wrapper' =>
'div',
'parameters' => [
70 $this->
getIfExists(
'newtalk', [
'wrapper' =>
'div',
'parameters' => [
71 'class' =>
'usermessage'
74 Html::element(
'a', [
'href' =>
'#column-one',
'class' =>
'mw-jump-link' ],
75 $this->
getMsg(
'monobook-jumptonavigation' )->
text()
77 Html::element(
'a', [
'href' =>
'#searchInput',
'class' =>
'mw-jump-link' ],
78 $this->
getMsg(
'monobook-jumptosearch' )->
text()
80 '<!-- start content -->' .
82 $this->
get(
'bodytext' ) .
85 '<!-- end content -->' .
96 'lang' => $this->
get(
'userlang' ),
97 'dir' => $this->
get(
'dir' )
102 Html::rawElement(
'div', [
'class' =>
'portlet',
'id' =>
'p-logo',
'role' =>
'banner' ],
105 'href' => $this->data[
'nav_urls'][
'mainpage'][
'href'],
106 'class' =>
'mw-wiki-logo',
118 $this->
getMsg(
'monobook-jumptopersonal' )->
text()
125 $html .=
'<!-- end of the left (by default at least) column -->';
152 'href' =>
"#$target",
154 'class' =>
'menu-toggle',
155 'id' =>
"$target-toggle"
166 $allTabs = $this->data[
'content_actions'];
167 $tabCount = count( $allTabs );
170 if ( $tabCount > 2 ) {
171 $html .= $this->
getBox(
'cactions', $allTabs,
'monobook-cactions-label' );
174 $html .= $this->
getBox(
'cactions', $allTabs,
'monobook-cactions-label',
175 [
'extra-classes' =>
'nomobile' ]
180 $tabs = $this->data[
'content_navigation'][
'namespaces'];
181 foreach ( $tabs as $tab => $attribs ) {
182 $tabs[$tab][
'id'] = $attribs[
'id'] .
'-mobile';
183 $tabs[$tab][
'title'] = $attribs[
'text'];
186 if ( $tabCount !== 1 ) {
189 'text' => $this->
getMsg(
'monobook-more-actions' )->text(),
190 'href' =>
'#p-cactions',
195 'text' => $this->
getMsg(
'toolbox' )->text(),
198 'title' => $this->
getMsg(
'toolbox' )->text()
200 if ( $this->data[
'language_urls'] !==
false ) {
201 $tabs[
'languages'] = [
202 'text' => $this->
getMsg(
'otherlanguages' )->text(),
204 'id' =>
'ca-languages',
205 'title' => $this->
getMsg(
'otherlanguages' )->text()
209 $html .= $this->
getBox(
'cactions-mobile', $tabs,
'monobook-cactions-label' );
220 $sidebar = $this->data[
'sidebar'];
223 if ( !isset( $sidebar[
'SEARCH'] ) ) {
224 $sidebar[
'SEARCH'] =
true;
226 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
227 $sidebar[
'TOOLBOX'] =
true;
229 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
230 $sidebar[
'LANGUAGES'] =
true;
233 foreach ( $sidebar as $boxName =>
$content ) {
239 $boxName = (string)$boxName;
241 if ( $boxName ==
'SEARCH' ) {
243 } elseif ( $boxName ==
'TOOLBOX' ) {
245 } elseif ( $boxName ==
'LANGUAGES' ) {
252 [
'extra-classes' =>
'generated-sidebar' ]
268 if ( $this->config->get(
'UseTwoButtonsSearchForm' ) ) {
271 [
'id' =>
'mw-searchButton',
'class' =>
'searchButton' ]
275 Html::rawElement(
'a', [
'href' => $this->
get(
'searchaction' ),
'rel' =>
'search' ],
276 $this->
getMsg(
'powersearch-legend' )->escaped()
280 $searchInputId =
'searchInput';
282 'action' => $this->
get(
'wgScript' ),
287 $this->
makeSearchButton(
'go', [
'id' =>
'searchGoButton',
'class' =>
'searchButton' ] ) .
291 $html .= $this->
getBox(
'search', $searchForm,
null, [
292 'search-input-id' => $searchInputId,
294 'body-id' =>
'searchBody'
309 $html .= $this->
getBox(
'tb', $this->
getToolbox(),
'toolbox', [
'hooks' => [
311 'MonoBookTemplateToolboxEnd' => [ &$template ],
312 'SkinTemplateToolboxEnd' => [ &$template,
true ]
328 if ( $this->data[
'language_urls'] !==
false ) {
329 $html .= $this->
getBox(
'lang', $this->data[
'language_urls'],
'otherlanguages' );
346 protected function getBox( $name, $contents, $msg =
null, $setOptions = [] ) {
347 $options = array_merge( [
348 'class' =>
'portlet',
349 'body-class' =>
'pBody',
354 if ( $name ==
'personal' ) {
358 if ( array_key_exists(
'uls', $contents ) ) {
359 $prependiture .= $this->
makeListItem(
'uls', $contents[
'uls'] );
360 unset( $contents[
'uls'] );
367 [
'id' =>
'pt-anonuserpage' ],
368 $this->
getMsg(
'notloggedin' )->escaped()
371 $options[
'list-prepend'] = $prependiture;
374 return $this->
getPortlet( $name, $contents, $msg, $options );
389 $options = array_merge( [
391 'role' =>
'navigation',
392 'search-input-id' =>
'searchInput',
394 'id' =>
'p-' . $name,
395 'class' =>
'mw-portlet',
396 'extra-classes' =>
'',
398 'body-class' =>
'mw-portlet-body',
399 'body-extra-classes' =>
'',
401 'text-wrapper' => [
'tag' =>
'span' ],
409 if ( $msg ===
null ) {
412 } elseif ( is_array( $msg ) ) {
413 $msgString = array_shift( $msg );
419 $msgObj = $this->
getMsg( $msg, $msgParams );
420 if ( $msgObj->exists() ) {
421 $msgString = $msgObj->parse();
423 $msgString = htmlspecialchars( $msg );
430 [
'lang' => $this->
get(
'userlang' ),
'dir' => $this->
get(
'dir' ) ]
432 $contentText .= $options[
'list-prepend'];
433 foreach (
$content as $key => $item ) {
434 if ( is_array( $options[
'text-wrapper'] ) ) {
438 [
'text-wrapper' => $options[
'text-wrapper'] ]
448 if ( is_array( $options[
'hooks'] ) ) {
449 foreach ( $options[
'hooks'] as $hook => $hookOptions ) {
461 'role' => $options[
'role'],
462 'class' => $this->
mergeClasses( $options[
'class'], $options[
'extra-classes'] ),
466 if ( $options[
'role'] !==
'search' ) {
467 $divOptions[
'aria-labelledby'] = $labelId;
471 'lang' => $this->
get(
'userlang' ),
472 'dir' => $this->
get(
'dir' )
474 if ( $options[
'role'] ==
'search' ) {
475 $msgString =
Html::rawElement(
'label', [
'for' => $options[
'search-input-id'] ], $msgString );
479 'class' => $this->
mergeClasses( $options[
'body-class'], $options[
'body-extra-classes'] )
481 if ( is_string( $options[
'body-id'] ) ) {
482 $bodyDivOptions[
'id'] = $options[
'body-id'];
508 if ( !is_array( $class ) ) {
511 if ( !is_array( $extraClasses ) ) {
512 $extraClasses = [ $extraClasses ];
515 return array_merge( $class, $extraClasses );
531 $hookContents = ob_get_contents();
533 if ( !trim( $hookContents ) ) {
537 return $hookContents;
554 foreach ( $setOptions as $key => $value ) {
555 $options[$key] = $value;
560 if ( ( $options[
'loose'] && $this->data[$object] !=
'' ) ||
561 ( !$options[
'loose'] && $this->data[$object] ) ) {
562 if ( $options[
'wrapper'] ==
'none' ) {
563 $html .= $this->
get( $object );
567 $options[
'parameters'],
568 $this->
get( $object )
589 'role' =>
'contentinfo',
590 'lang' => $this->
get(
'userlang' ),
591 'dir' => $this->
get(
'dir' )
594 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
597 'class' =>
'footer-icons'
599 foreach ( $footerIcons as $icon ) {
600 $html .= $this->
getSkin()->makeFooterIcon( $icon );
604 if ( count( $validFooterLinks ) > 0 ) {
606 foreach ( $validFooterLinks as $aLink ) {
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
mergeClasses( $class, $extraClasses)
Helper function for getPortlet.
makeSearchButton( $mode, $attrs=[])
execute()
Template filter callback for MonoBook skin.
getBox( $name, $contents, $msg=null, $setOptions=[])
Generate a sidebar box using getPortlet(); prefill some common stuff.
static escapeIdForAttribute( $id, $mode=self::ID_PRIMARY)
Given a section name or other user-generated or otherwise unsafe string, escapes it to be a valid HTM...
getClear()
Get a div with the core visualClear class, for clearing floats.
getToolboxBox()
Generate the toolbox, complete with all three old hooks.
getPortlet( $name, $content, $msg=null, $setOptions=[])
Generates a block of navigation links with a header.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
getSkin()
Get the Skin object related to this object.
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
getCactions()
Generate the cactions (content actions) tabs, as well as a second set of spoof tabs for mobile.
static closeElement( $element)
Returns "</$element>".
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
getSimpleFooter()
Renderer for getFooterIcons and getFooterLinks as a generic footer block.
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
getMobileNavigationIcon( $target, $title)
Create a wrapped link to create a mobile toggle/jump icon Needs to be an on-page link (as opposed to ...
makeSearchInput( $attrs=[])
getLanguageBox()
Generate the languages box.
getSearchBox()
Generate the search, using config options for buttons (?)
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
getRenderedSidebar()
Generate the full sidebar.
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
getIfExists( $object, $setOptions=[])
Simple wrapper for random if-statement-wrapped $this->data things.
getTrail()
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.
getMsg( $name,... $params)
Get a Message object with its context set.
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
deprecatedHookHack( $hook, $hookOptions=[])
Wrapper to catch output of old hooks expecting to write directly to page We no longer do things that ...
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
New base template for a skin's template extended from QuickTemplate this class features helper method...