From 3ed80375f2bc9dfdde955be8d2ec5aa6a574100d Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Wed, 28 Jun 2017 21:56:37 +0200 Subject: [PATCH] Add canonical id to header on action=info Have to use the h2, because the span can have only one id attribute Bug: T44629 Change-Id: Iaa1c46611c56210b1177a665a5edfa082683977f --- includes/actions/InfoAction.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 886bf376e2..baec944e67 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -127,7 +127,10 @@ class InfoAction extends FormlessAction { // Messages: // pageinfo-header-basic, pageinfo-header-edits, pageinfo-header-restrictions, // pageinfo-header-properties, pageinfo-category-info - $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() ) . "\n"; + $content .= $this->makeHeader( + $this->msg( "pageinfo-${header}" )->escaped(), + "mw-pageinfo-${header}" + ) . "\n"; $table = "\n"; foreach ( $infoTable as $infoRow ) { $name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0]; @@ -152,10 +155,11 @@ class InfoAction extends FormlessAction { * @param string $header The header text. * @return string The HTML. */ - protected function makeHeader( $header ) { + protected function makeHeader( $header, $canonicalId ) { $spanAttribs = [ 'class' => 'mw-headline', 'id' => Sanitizer::escapeId( $header ) ]; + $h2Attribs = [ 'id' => Sanitizer::escapeId( $canonicalId ) ]; - return Html::rawElement( 'h2', [], Html::element( 'span', $spanAttribs, $header ) ); + return Html::rawElement( 'h2', $h2Attribs, Html::element( 'span', $spanAttribs, $header ) ); } /** -- 2.20.1