Alex Monk has uploaded a new change for review. https://gerrit.wikimedia.org/r/148376
Change subject: Put a link to the entity's canonical URI in the toolbox ...................................................................... Put a link to the entity's canonical URI in the toolbox Bug: 54275 Change-Id: I69985b45222dc8e2b19686b55a76a330e31805ac --- M repo/Wikibase.hooks.php M repo/Wikibase.php M repo/i18n/en.json M repo/i18n/qqq.json 4 files changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/76/148376/1 diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index 0b20cc4..cacf941 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -1272,4 +1272,25 @@ return true; } + public static function onSkinTemplateBuildNavUrlsNav_urlsAfterPermalink( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { + $title = $skintemplate->getTitle(); + + if ( NamespaceUtils::isEntityNamespace( $title->getNamespace() ) ) { + $nav_urls['wb-canonicalURI'] = array( + 'text' => $skintemplate->msg( 'wikibase-canonicaluri-toolboxlink' ), + 'href' => WikibaseRepo::getDefaultInstance()->getRdfBaseURI() . $title->getDBKey() + ); + } + + return true; + } + + public static function onBaseTemplateToolbox( $skintemplate, &$toolbox ) { + if ( isset( $skintemplate->data['nav_urls']['wb-canonicalURI'] ) ) { + $toolbox['wb-canonicalURI'] = $skintemplate->data['nav_urls']['wb-canonicalURI']; + $toolbox['wb-canonicalURI']['id'] = 'wb-canonicalURI'; + } + + return true; + } } diff --git a/repo/Wikibase.php b/repo/Wikibase.php index 31cf2c9..5e5488b 100644 --- a/repo/Wikibase.php +++ b/repo/Wikibase.php @@ -211,6 +211,8 @@ $wgHooks['ContentHandlerForModelID'][] = 'Wikibase\RepoHooks::onContentHandlerForModelID'; $wgHooks['APIQuerySiteInfoStatisticsInfo'][] = 'Wikibase\RepoHooks::onAPIQuerySiteInfoStatisticsInfo'; $wgHooks['ImportHandleRevisionXMLTag'][] = 'Wikibase\RepoHooks::onImportHandleRevisionXMLTag'; + $wgHooks['BaseTemplateToolbox'][] = 'Wikibase\RepoHooks::onBaseTemplateToolbox'; + $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'Wikibase\RepoHooks::onSkinTemplateBuildNavUrlsNav_urlsAfterPermalink'; // Resource Loader Modules: $wgResourceModules = array_merge( $wgResourceModules, include( __DIR__ . "/resources/Resources.php" ) ); diff --git a/repo/i18n/en.json b/repo/i18n/en.json index 766354c..ee4494b 100644 --- a/repo/i18n/en.json +++ b/repo/i18n/en.json @@ -348,6 +348,7 @@ "wikibase-listdatatypes-time-body": "Literal data field for a time value. Given as a time with some precision and boundaries. The time is always saved internally in the Proleptic Gregorian format, but can use other formats during parsing and formatting.(?)\n* time – explicit value for point in time, represented per ISO8601, the year always having 11 digits and the date always being signed, in the format +00000002013-01-01T00:00:00Z\n* timezone – explicit value as a signed integer. Timezone information as an offset from UTC in minutes.\n* before – explicit integer value for how many units after the given time it could be. The unit is given by the precision.\n* after – explicit integer value for how many units before the given time it could be. The unit is given by the precision.\n* precision – explicit value encoded in a shortint. The numbers have the following meaning: 0 - billion years, 1 - hundred million years, ..., 6 - millennium, 7 - century, 8 - decade, 9 - year, 10 - month, 11 - day, 12 - hour, 13 - minute, 14 - second.\n* calendarmodel – explicit value given as a URI. It will identify the calendar model that should be used to display this time value.", "wikibase-listdatatypes-url-head": "URL", "wikibase-listdatatypes-url-body": "Literal data field for a URL. URLs are restricted to the protocols also supported for external links in wikitext.", + "wikibase-canonicaluri-toolboxlink": "Canonical link", "datatypes-type-url": "URL", "content-model-wikibase-item": "Wikibase item", "content-model-wikibase-property": "Wikibase property", diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json index 9570116..9a620fe 100644 --- a/repo/i18n/qqq.json +++ b/repo/i18n/qqq.json @@ -370,6 +370,7 @@ "wikibase-listdatatypes-time-body": "{{Wikibase-datatype-body|Time}}", "wikibase-listdatatypes-url-head": "{{Wikibase-datatype-head|Url}}\n{{Identical|URL}}", "wikibase-listdatatypes-url-body": "{{Wikibase-datatype-body|Url}}", + "wikibase-canonicaluri-toolboxlink": "Text for canonical link in toolbox on entity pages.", "datatypes-type-url": "Unused at this time.\n{{Identical|URL}}", "content-model-wikibase-item": "The name for Wikibase item content model, used when describing what type of content a page contains.", "content-model-wikibase-property": "The name for Wikibase property content model, used when describing what type of content a page contains.", -- To view, visit https://gerrit.wikimedia.org/r/148376 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I69985b45222dc8e2b19686b55a76a330e31805ac Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Alex Monk <kren...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits