Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348110 )

Change subject: Show supported data formats in Special:EntityData
......................................................................

Show supported data formats in Special:EntityData

Bug: T162870
Change-Id: I1d1124611f0a95cc24473ed0d84fd8e7ebd2effe
---
M repo/i18n/en.json
M repo/includes/Specials/SpecialEntityData.php
2 files changed, 14 insertions(+), 2 deletions(-)


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

diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index eb628bc..ebce094 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -300,7 +300,7 @@
        "wikibase-entitydata-unsupported-format": "The data format $1 is not 
supported by this interface.",
        "wikibase-entitydata-storage-error": "Failed to load entity $1.",
        "wikibase-entitydata-title": "Entity Data",
-       "wikibase-entitydata-text": "This page provides a linked data interface 
to entity values. Please provide the entity ID in the URL, using subpage 
syntax.\n* Content negotiation applies based on you client's Accept header. 
This means that the entity data will be provided in the format preferred by 
your client. For a web browser, this will be HTML, causing your browser to be 
redirected to the regular entity page.\n* You can explicitly request a specific 
data format by adding the appropriate file extension to the entity ID: Q23.json 
will return data in the JSON format, Q23.ttl will return RDF/Turtle, and so 
on.",
+       "wikibase-entitydata-text": "This page provides a linked data interface 
to entity values. Please provide the entity ID in the URL, using subpage 
syntax.\n* Content negotiation applies based on you client's Accept header. 
This means that the entity data will be provided in the format preferred by 
your client. For a web browser, this will be HTML, causing your browser to be 
redirected to the regular entity page.\n* You can explicitly request a specific 
data format by adding the appropriate file extension to the entity ID: Q23.json 
will return data in the JSON format, Q23.ttl will return RDF/Turtle, and so on. 
Supported formats are: $1",
        "special-entitypage": "Entity page",
        "wikibase-entitypage-title": "Entity Page",
        "wikibase-entitypage-text": "This page redirects to the entity page on 
the repository it belongs to. Please provide the entity ID in the URL, using 
subpage syntax.",
diff --git a/repo/includes/Specials/SpecialEntityData.php 
b/repo/includes/Specials/SpecialEntityData.php
index 82f680e..88ef256 100644
--- a/repo/includes/Specials/SpecialEntityData.php
+++ b/repo/includes/Specials/SpecialEntityData.php
@@ -30,6 +30,11 @@
         */
        private $requestHandler = null;
 
+       /**
+        * @var EntityDataFormatProvider|null
+        */
+       private $entityDataFormatProvider = null;
+
        public function __construct() {
                parent::__construct( 'EntityData' );
        }
@@ -121,6 +126,7 @@
                        $titleLookup
                );
 
+               $this->entityDataFormatProvider = $entityDataFormatProvider;
                return new EntityDataRequestHandler(
                        $uriManager,
                        $titleLookup,
@@ -162,7 +168,13 @@
        public function showForm() {
                //TODO: show input form with selector for format and field for 
ID. Add some explanation,
                //      point to meta-info like schema and license, and 
generally be a helpful data endpoint.
-               $this->getOutput()->showErrorPage( 'wikibase-entitydata-title', 
'wikibase-entitydata-text' );
+               $supportedFormats = 
$this->entityDataFormatProvider->getSupportedFormats();
+               $supportedFormats[] = 'html';
+               $this->getOutput()->showErrorPage(
+                       'wikibase-entitydata-title',
+                       'wikibase-entitydata-text',
+                       [ $this->getOutput()->getLanguage()->commaList( 
$supportedFormats ) ]
+               );
        }
 
 }

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

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

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

Reply via email to