Jdlrobson has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/393881 )
Change subject: Show tagline on Special:MobileOptions page
......................................................................
Show tagline on Special:MobileOptions page
Restrict the existing setting of wikidata descriptions to pages
in the main namespace. This will allow us to make the Minerva skin
dumber about when it should render and when it should not.
Also set a tagline for the special page MobileOptions
Bug: T180095
Change-Id: I3f5886715f0632e67e46e077d362a988a648a123
---
M i18n/en.json
M i18n/qqq.json
M includes/MobileFrontend.hooks.php
3 files changed, 19 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/81/393881/1
diff --git a/i18n/en.json b/i18n/en.json
index fdfaf3a..56570a4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -198,6 +198,7 @@
"mobile-frontend-search-content": "Search within pages",
"mobile-frontend-search-content-no-results":
"'''{{int:mobile-frontend-search-content}}''' to see if this phrase appears
anywhere.",
"mobile-frontend-search-no-results": "No page with this title.",
+ "mobile-frontend-settings-tagline": "Reading preferences",
"mobile-frontend-settings-beta": "Beta",
"mobile-frontend-settings-site-description": "{{SITENAME}} is available
in $1 {{PLURAL:$1|language|languages}}. All available versions are listed
below",
"mobile-frontend-settings-site-header": "{{SITENAME}} Languages",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index e78a15e..4baaf0b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -199,6 +199,7 @@
"mobile-frontend-search-content": "Caption for a button performing full
text search of a given search query.\n\nUsed in
{{msg-mw|Mobile-frontend-search-content-no-results}}.",
"mobile-frontend-search-content-no-results": "Used when no pages with
matching titles were found.\n\nRefers to
{{msg-mw|Mobile-frontend-search-content}}.",
"mobile-frontend-search-no-results": "Message informing user that no
pages were found for a given query.",
+ "mobile-frontend-settings-tagline": "Tagline for Special:MobileOptions
- will show under heading",
"mobile-frontend-settings-beta": "Text for beta on settings
page.\n{{Identical|Beta}}",
"mobile-frontend-settings-site-description": "Shown on
[[Special:MobileOptions]]. Parameters:\n* $1 - the number of other language
versions for this wiki",
"mobile-frontend-settings-site-header": "Heading for the
Special:MobileOptions/Language page - only visible to non JavaScript users",
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index caa2491..08b2c68 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -580,6 +580,9 @@
);
if ( $name === 'Userlogin' || $name === 'CreateAccount'
) {
$special->getOutput()->addModules(
'mobile.special.userlogin.scripts' );
+ } else if ( $name === 'MobileOptions' ) {
+ self::setTagline( $special->getOutput(),
+ wfMessage(
'mobile-frontend-settings-tagline' ) );
}
}
@@ -1061,6 +1064,16 @@
}
/**
+ * Sets a tagline for a given page that can be displayed by the skin.
+ *
+ * @param OutputPage $outputPage
+ * @param string $desc
+ */
+ private static function setTagline( OutputPage $outputPage, $desc ) {
+ $outputPage->setProperty( 'wgMFDescription', $desc );
+ }
+
+ /**
* OutputPageParserOutput hook handler
* Disables TOC in output before it grabs HTML
* @see
https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput
@@ -1075,13 +1088,14 @@
if ( $context->shouldDisplayMobileView() ) {
$po->setTOCEnabled( false );
$outputPage->setProperty( 'MFTOC', $po->getTOCHTML()
!== '' );
-
- if ( $context->shouldShowWikibaseDescriptions(
'tagline' ) ) {
+ $title = $outputPage->getTitle();
+ // Only set the tagline if the feature has been enabled
and the article is in the main namespace
+ if ( $context->shouldShowWikibaseDescriptions(
'tagline' ) && $title->getNamespace() === NS_MAIN ) {
$item = $po->getProperty( 'wikibase_item' );
if ( $item ) {
$desc =
ExtMobileFrontend::getWikibaseDescription( $item );
if ( $desc ) {
- $outputPage->setProperty(
'wgMFDescription', $desc );
+ self::setTagline( $desc );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/393881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f5886715f0632e67e46e077d362a988a648a123
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: specialpages
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits