[MediaWiki-commits] [Gerrit] Pass EditSectionGenerator to EntityViewFactory - change (mediawiki...Wikibase)
Adrian Lang has uploaded a new change for review. https://gerrit.wikimedia.org/r/200820 Change subject: Pass EditSectionGenerator to EntityViewFactory .. Pass EditSectionGenerator to EntityViewFactory This is a prerequisite for T93745. EntityViewFactory is part of WikibaseView, but it currently references RepoSpecialPageLinker, which is part of WikibaseRepo. Change-Id: I4bd4bfb3fde415b815a3daa16e28d967954af346 --- M repo/includes/EntityParserOutputGenerator.php M repo/includes/EntityParserOutputGeneratorFactory.php M repo/includes/View/EntityViewFactory.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 6 files changed, 48 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/20/200820/1 diff --git a/repo/includes/EntityParserOutputGenerator.php b/repo/includes/EntityParserOutputGenerator.php index 279d942..5e2f424 100644 --- a/repo/includes/EntityParserOutputGenerator.php +++ b/repo/includes/EntityParserOutputGenerator.php @@ -20,7 +20,11 @@ use Wikibase\Lib\Store\EntityInfoTermLookup; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Lib\Store\LanguageFallbackLabelLookup; +use Wikibase\Repo\View\EmptyEditSectionGenerator; use Wikibase\Repo\View\EntityViewFactory; +use Wikibase\Repo\View\RepoSpecialPageLinker; +use Wikibase\Repo\View\ToolbarEditSectionGenerator; +use Wikibase\Template\TemplateFactory; /** * Creates the parser output for an entity. @@ -76,6 +80,11 @@ */ private $referencedEntitiesFinder; + /** +* @var TemplateFactory +*/ + private $templateFactory; + public function __construct( EntityViewFactory $entityViewFactory, ParserOutputJsConfigBuilder $configBuilder, @@ -83,7 +92,8 @@ ValuesFinder $valuesFinder, EntityInfoBuilderFactory $entityInfoBuilderFactory, LanguageFallbackChain $languageFallbackChain, - $languageCode + $languageCode, + TemplateFactory $templateFactory ) { $this-entityViewFactory = $entityViewFactory; $this-configBuilder = $configBuilder; @@ -94,6 +104,7 @@ $this-languageCode = $languageCode; $this-referencedEntitiesFinder = new ReferencedEntitiesFinder(); + $this-templateFactory = $templateFactory; } /** @@ -312,7 +323,7 @@ /** * @param ParserOutput $parserOutput * @param EntityRevision $entityRevision -* @param EntityInfo $entityInfo obtained from EntityInfoBuilder::getEntityInfo +* @param EntityInfo $entityInfo * @param bool $editable */ private function addHtmlToParserOutput( @@ -327,12 +338,17 @@ $this-languageFallbackChain ); + $editSectionGenerator = $editable ? new ToolbarEditSectionGenerator( + new RepoSpecialPageLinker(), + $this-templateFactory + ) : new EmptyEditSectionGenerator(); + $entityView = $this-entityViewFactory-newEntityView( $entityRevision-getEntity()-getType(), $this-languageCode, $labelLookup, $this-languageFallbackChain, - $editable + $editSectionGenerator ); $html = $entityView-getHtml( $entityRevision ); diff --git a/repo/includes/EntityParserOutputGeneratorFactory.php b/repo/includes/EntityParserOutputGeneratorFactory.php index e113b72..de2f03f 100644 --- a/repo/includes/EntityParserOutputGeneratorFactory.php +++ b/repo/includes/EntityParserOutputGeneratorFactory.php @@ -3,13 +3,13 @@ namespace Wikibase; use ParserOptions; -use RequestContext; use ValueFormatters\ValueFormatter; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Store\EntityInfoBuilderFactory; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Repo\View\EntityViewFactory; +use Wikibase\Template\TemplateFactory; /** * @since 0.5 @@ -18,6 +18,11 @@ * @author Katie Filbert aude.w...@gmail.com */ class EntityParserOutputGeneratorFactory { + + /** +* @var TemplateFactory +*/ + private $templateFactory; /** * @var EntityViewFactory @@ -55,7 +60,8 @@ EntityTitleLookup $entityTitleLookup, EntityIdParser $entityIdParser, ValuesFinder $valuesFinder, - LanguageFallbackChainFactory $languageFallbackChainFactory + LanguageFallbackChainFactory
[MediaWiki-commits] [Gerrit] Pass EditSectionGenerator to EntityViewFactory - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Pass EditSectionGenerator to EntityViewFactory .. Pass EditSectionGenerator to EntityViewFactory This is a prerequisite for T93745. EntityViewFactory is part of WikibaseView, but it currently references RepoSpecialPageLinker, which is part of WikibaseRepo. Change-Id: I4bd4bfb3fde415b815a3daa16e28d967954af346 --- M repo/includes/EntityParserOutputGenerator.php M repo/includes/EntityParserOutputGeneratorFactory.php M repo/includes/View/EntityViewFactory.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 6 files changed, 48 insertions(+), 19 deletions(-) Approvals: Aude: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/EntityParserOutputGenerator.php b/repo/includes/EntityParserOutputGenerator.php index 279d942..5e2f424 100644 --- a/repo/includes/EntityParserOutputGenerator.php +++ b/repo/includes/EntityParserOutputGenerator.php @@ -20,7 +20,11 @@ use Wikibase\Lib\Store\EntityInfoTermLookup; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Lib\Store\LanguageFallbackLabelLookup; +use Wikibase\Repo\View\EmptyEditSectionGenerator; use Wikibase\Repo\View\EntityViewFactory; +use Wikibase\Repo\View\RepoSpecialPageLinker; +use Wikibase\Repo\View\ToolbarEditSectionGenerator; +use Wikibase\Template\TemplateFactory; /** * Creates the parser output for an entity. @@ -76,6 +80,11 @@ */ private $referencedEntitiesFinder; + /** +* @var TemplateFactory +*/ + private $templateFactory; + public function __construct( EntityViewFactory $entityViewFactory, ParserOutputJsConfigBuilder $configBuilder, @@ -83,7 +92,8 @@ ValuesFinder $valuesFinder, EntityInfoBuilderFactory $entityInfoBuilderFactory, LanguageFallbackChain $languageFallbackChain, - $languageCode + $languageCode, + TemplateFactory $templateFactory ) { $this-entityViewFactory = $entityViewFactory; $this-configBuilder = $configBuilder; @@ -94,6 +104,7 @@ $this-languageCode = $languageCode; $this-referencedEntitiesFinder = new ReferencedEntitiesFinder(); + $this-templateFactory = $templateFactory; } /** @@ -312,7 +323,7 @@ /** * @param ParserOutput $parserOutput * @param EntityRevision $entityRevision -* @param EntityInfo $entityInfo obtained from EntityInfoBuilder::getEntityInfo +* @param EntityInfo $entityInfo * @param bool $editable */ private function addHtmlToParserOutput( @@ -327,12 +338,17 @@ $this-languageFallbackChain ); + $editSectionGenerator = $editable ? new ToolbarEditSectionGenerator( + new RepoSpecialPageLinker(), + $this-templateFactory + ) : new EmptyEditSectionGenerator(); + $entityView = $this-entityViewFactory-newEntityView( $entityRevision-getEntity()-getType(), $this-languageCode, $labelLookup, $this-languageFallbackChain, - $editable + $editSectionGenerator ); $html = $entityView-getHtml( $entityRevision ); diff --git a/repo/includes/EntityParserOutputGeneratorFactory.php b/repo/includes/EntityParserOutputGeneratorFactory.php index e113b72..de2f03f 100644 --- a/repo/includes/EntityParserOutputGeneratorFactory.php +++ b/repo/includes/EntityParserOutputGeneratorFactory.php @@ -3,13 +3,13 @@ namespace Wikibase; use ParserOptions; -use RequestContext; use ValueFormatters\ValueFormatter; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Store\EntityInfoBuilderFactory; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Repo\View\EntityViewFactory; +use Wikibase\Template\TemplateFactory; /** * @since 0.5 @@ -18,6 +18,11 @@ * @author Katie Filbert aude.w...@gmail.com */ class EntityParserOutputGeneratorFactory { + + /** +* @var TemplateFactory +*/ + private $templateFactory; /** * @var EntityViewFactory @@ -55,7 +60,8 @@ EntityTitleLookup $entityTitleLookup, EntityIdParser $entityIdParser, ValuesFinder $valuesFinder, - LanguageFallbackChainFactory $languageFallbackChainFactory + LanguageFallbackChainFactory $languageFallbackChainFactory, + TemplateFactory $templateFactory )