jenkins-bot has submitted this change and it was merged.
Change subject: Add EntityHandler::makeParserOptions
......................................................................
Add EntityHandler::makeParserOptions
Picked from I2541d384fe42
Change-Id: Ic74561766dfbf1a887764ac724de2585b91f9338
---
M extensions/Wikibase/repo/includes/content/EntityContent.php
M extensions/Wikibase/repo/includes/content/EntityHandler.php
2 files changed, 25 insertions(+), 2 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extensions/Wikibase/repo/includes/content/EntityContent.php
b/extensions/Wikibase/repo/includes/content/EntityContent.php
index 979941b..16b71ad 100644
--- a/extensions/Wikibase/repo/includes/content/EntityContent.php
+++ b/extensions/Wikibase/repo/includes/content/EntityContent.php
@@ -175,8 +175,6 @@
* @return EntityView
*/
public function getEntityView( IContextSource $context = null,
ParserOptions $options = null, LanguageFallbackChain $languageFallbackChain =
null ) {
- $lang = null;
-
//TODO: cache last used entity view
if ( $context === null ) {
diff --git a/extensions/Wikibase/repo/includes/content/EntityHandler.php
b/extensions/Wikibase/repo/includes/content/EntityHandler.php
index 71672f7..f68d229 100644
--- a/extensions/Wikibase/repo/includes/content/EntityHandler.php
+++ b/extensions/Wikibase/repo/includes/content/EntityHandler.php
@@ -8,6 +8,7 @@
use MWException;
use Revision;
use Title;
+use RequestContext;
/**
* Base handler class for Wikibase\Entity content classes.
@@ -52,6 +53,30 @@
}
/**
+ * @see ContentHandler::makeParserOptions
+ *
+ * @since 0.5
+ *
+ * @param IContextSource|User|string $context
+ *
+ * @return ParserOptions
+ */
+ public function makeParserOptions( $context ) {
+ if ( $context === 'canonical' ) {
+ // There are no "canonical" ParserOptions for Wikibase,
+ // as everything is User-language dependent
+ $context = RequestContext::getMain();
+ }
+
+ $options = parent::makeParserOptions( $context );
+
+ // The html representation of entities depends on the user
language, so we
+ // have to call ParserOptions::getUserLangObj to split the
cache by user language.
+ $options->getUserLangObj();
+ return $options;
+ }
+
+ /**
* Creates a Content object for the given Entity object.
*
* @since 0.4
--
To view, visit https://gerrit.wikimedia.org/r/110937
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic74561766dfbf1a887764ac724de2585b91f9338
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits