Daniel Kinzler has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/245506

Change subject: Add documentation of PageTerms in repo-mode.
......................................................................

Add documentation of PageTerms in repo-mode.

Change-Id: I391f849caa0e5287b2e7aebddab5df1b6b829f98
---
M client/WikibaseClient.php
M client/i18n/en.json
M client/includes/api/PageTerms.php
3 files changed, 19 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/06/245506/1

diff --git a/client/WikibaseClient.php b/client/WikibaseClient.php
index fcb7ba9..88c9f1d 100644
--- a/client/WikibaseClient.php
+++ b/client/WikibaseClient.php
@@ -149,9 +149,12 @@
        $wgAPIPropModules['pageterms'] = array(
                'class' => 'Wikibase\Client\Api\PageTerms',
                'factory' => function ( ApiQuery $query, $moduleName ) {
-                       //FIXME: HACK: make pageterms work directly on entity 
pages on the repo.
+                       // FIXME: HACK: make pageterms work directly on entity 
pages on the repo.
                        // We should instead use an EntityIdLookup that 
combines the repo and the client
                        // implementation, see T115117.
+                       // NOTE: when changing repo and/or client integration, 
remember to update the
+                       // self-documentation of the API module in the 
"apihelp-query+pageterms-description"
+                       // message and the PageTerms::getExamplesMessages() 
method.
                        if ( defined( 'WB_VERSION' ) ) {
                                $repo = 
\Wikibase\Repo\WikibaseRepo::getDefaultInstance();
                                $termIndex = $repo->getStore()->getTermIndex();
diff --git a/client/i18n/en.json b/client/i18n/en.json
index 458f41a..9e414ab 100644
--- a/client/i18n/en.json
+++ b/client/i18n/en.json
@@ -11,9 +11,10 @@
        "wikibase-client-desc": "Client for the Wikibase extension",
        "tooltip-t-wikibase": "Link to connected data repository item",
        "accesskey-t-wikibase": "g",
-       "apihelp-query+pageterms-description": "Get terms associated with a 
page via an associated data item.",
+       "apihelp-query+pageterms-description": "Get terms associated with a 
page via an associated data item. On a wikibase entity page, the entity terms 
are used directly.\nCaveat: On a repo wiki, pageterms only works directly on 
entity pages, not on pages connected to an item. This may change in the 
future.",
        "apihelp-query+pageterms-example-simple": "Get all terms associated 
with the page 'London', in the user language.",
        "apihelp-query+pageterms-example-label-en": "Get labels and aliases 
associated with the page 'London', in English.",
+       "apihelp-query+pageterms-example-item": "Get labels and aliases of item 
Q84.",
        "apihelp-query+pageterms-param-terms": "The types of terms to get, e.g. 
'description'. If not specified, all types are returned.",
        "apihelp-query+wikibase-description": "Get information about the 
Wikibase client and the associated Wikibase repository.",
        "apihelp-query+wikibase-example": "Get URL path and other information 
about Wikibase client and repository.",
diff --git a/client/includes/api/PageTerms.php 
b/client/includes/api/PageTerms.php
index 49007ec..e8c852b 100644
--- a/client/includes/api/PageTerms.php
+++ b/client/includes/api/PageTerms.php
@@ -254,12 +254,19 @@
         * @see ApiBase::getExamplesMessages
         */
        protected function getExamplesMessages() {
-               return array(
-                       'action=query&prop=pageterms&titles=London'
-                               => 'apihelp-query+pageterms-example-simple',
-                       
'action=query&prop=pageterms&titles=London&wbptterms=label|alias&uselang=en'
-                               => 'apihelp-query+pageterms-example-label-en',
-               );
+               if ( defined( 'WB_VERSION' ) ) {
+                       return array(
+                               'action=query&prop=pageterms&titles=Q84'
+                                       => 
'apihelp-query+pageterms-example-item',
+                       );
+               } else {
+                       return array(
+                               'action=query&prop=pageterms&titles=London'
+                                       => 
'apihelp-query+pageterms-example-simple',
+                               
'action=query&prop=pageterms&titles=London&wbptterms=label|alias&uselang=en'
+                                       => 
'apihelp-query+pageterms-example-label-en',
+                       );
+               }
        }
 
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/245506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I391f849caa0e5287b2e7aebddab5df1b6b829f98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to