Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/55237
Change subject: (bug 46229) show edit link if an item is connected to a client
page
......................................................................
(bug 46229) show edit link if an item is connected to a client page
- if there is only one site link in the item, the edit link should
still appear on that linked wikipedia (client) page so that it is
easier to add more site links, and know if the page is connected or not.
Change-Id: I073a784552954c4b3a52291ecb46d126ef870025
---
M client/WikibaseClient.hooks.php
1 file changed, 18 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/37/55237/1
diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 6891b31..b1b3563 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -477,6 +477,11 @@
public static function onSkinTemplateOutputPageBeforeExec( \Skin
&$skin, \QuickTemplate &$template ) {
wfProfileIn( __METHOD__ );
+ if ( \Action::getActionName( $skin->getContext() ) !== 'view' )
{
+ wfProfileOut( __METHOD__ );
+ return true;
+ }
+
$title = $skin->getContext()->getTitle();
$namespaceChecker = new NamespaceChecker(
Settings::get( 'excludeNamespaces' ),
@@ -484,24 +489,6 @@
);
if ( $title->exists() && $namespaceChecker->isWikibaseEnabled(
$title->getNamespace() ) ) {
- if ( empty( $template->data['language_urls'] ) &&
\Action::getActionName( $skin->getContext() ) === 'view' ) {
- // if property is not set, it will return null
- $noExternalLangLinks =
$skin->getOutput()->getProperty( 'noexternallanglinks' );
-
- if ( $noExternalLangLinks === null ||
!in_array( '*', $noExternalLangLinks ) ) {
- // Placeholder in case the page doesn't
have any langlinks yet
- // self::onBeforePageDisplay adds the
JavaScript module which will overwrite this with a link
- $template->data['language_urls'][] =
array(
- 'text' => '',
- 'id' => 'wbc-linkToItem',
- 'class' => 'wbc-editpage
wbc-nolanglinks',
- );
- }
-
- wfProfileOut( __METHOD__ );
- return true;
- }
-
$prefixedId = $skin->getOutput()->getProperty(
'wikibase_item' );
if ( $prefixedId !== null ) {
@@ -521,6 +508,19 @@
'title' => wfMessage(
'wikibase-editlinkstitle' )->text(),
'class' => 'wbc-editpage',
);
+ } else {
+ // if property is not set, it will return null
+ $noExternalLangLinks =
$skin->getOutput()->getProperty( 'noexternallanglinks' );
+
+ if ( $noExternalLangLinks === null ||
!in_array( '*', $noExternalLangLinks ) ) {
+ // Placeholder in case the page doesn't
have any langlinks yet
+ // self::onBeforePageDisplay adds the
JavaScript module which will overwrite this with a link
+ $template->data['language_urls'][] =
array(
+ 'text' => '',
+ 'id' => 'wbc-linkToItem',
+ 'class' => 'wbc-editpage
wbc-nolanglinks',
+ );
+ }
}
}
--
To view, visit https://gerrit.wikimedia.org/r/55237
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I073a784552954c4b3a52291ecb46d126ef870025
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits