[MediaWiki-commits] [Gerrit] Inject siteLinkGroups into ItemView - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Inject siteLinkGroups into ItemView .. Inject siteLinkGroups into ItemView Change-Id: Icd9af0daf0353245eeb73c225dd9121a762d5e98 --- M repo/includes/View/EntityView.php M repo/includes/View/EntityViewFactory.php M repo/includes/View/ItemView.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 5 files changed, 50 insertions(+), 8 deletions(-) Approvals: Aude: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/View/EntityView.php b/repo/includes/View/EntityView.php index ee53a3b..59731f1 100644 --- a/repo/includes/View/EntityView.php +++ b/repo/includes/View/EntityView.php @@ -45,6 +45,11 @@ */ protected $textInjector; + /** +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +*/ public function __construct( FingerprintView $fingerprintView, ClaimsView $claimsView, diff --git a/repo/includes/View/EntityViewFactory.php b/repo/includes/View/EntityViewFactory.php index 0a942b4..66e76f6 100644 --- a/repo/includes/View/EntityViewFactory.php +++ b/repo/includes/View/EntityViewFactory.php @@ -42,15 +42,22 @@ */ private $sectionEditLinkGenerator; + /** +* @var string[] +*/ + private $siteLinkGroups; + public function __construct( EntityTitleLookup $entityTitleLookup, EntityLookup $entityLookup, - OutputFormatSnakFormatterFactory $snakFormatterFactory + OutputFormatSnakFormatterFactory $snakFormatterFactory, + array $siteLinkGroups ) { $this->entityTitleLookup = $entityTitleLookup; $this->entityLookup = $entityLookup; $this->snakFormatterFactory = $snakFormatterFactory; $this->sectionEditLinkGenerator = new SectionEditLinkGenerator(); + $this->siteLinkGroups = $siteLinkGroups; } /** @@ -78,7 +85,7 @@ // @fixme support more entity types if ( $entityType === 'item' ) { - return new ItemView( $fingerprintView, $claimsView, $language ); + return new ItemView( $fingerprintView, $claimsView, $language, $this->siteLinkGroups ); } elseif ( $entityType === 'property' ) { $displayStatementsOnProperties = WikibaseRepo::getDefaultInstance()->getSettings() ->getSetting( 'displayStatementsOnProperties' ); diff --git a/repo/includes/View/ItemView.php b/repo/includes/View/ItemView.php index 16fd88e..4c2f152 100644 --- a/repo/includes/View/ItemView.php +++ b/repo/includes/View/ItemView.php @@ -3,6 +3,7 @@ namespace Wikibase\Repo\View; use InvalidArgumentException; +use Language; use Wikibase\DataModel\Entity\Item; use Wikibase\EntityRevision; use Wikibase\Repo\WikibaseRepo; @@ -18,6 +19,30 @@ * @author Daniel Werner */ class ItemView extends EntityView { + + /** +* @var string[] +*/ + private $siteLinkGroups; + + /** +* @see EntityView::__construct +* +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +* @param string[] $siteLinkGroups +*/ + public function __construct( + FingerprintView $fingerprintView, + ClaimsView $claimsView, + Language $language, + array $siteLinkGroups + ) { + parent::__construct( $fingerprintView, $claimsView, $language ); + + $this->siteLinkGroups = $siteLinkGroups; + } /** * @see EntityView::getMainHtml @@ -54,8 +79,7 @@ protected function getTocSections() { $array = parent::getTocSections(); $array['claims'] = 'wikibase-statements'; - $groups = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'siteLinkGroups' ); - foreach ( $groups as $group ) { + foreach ( $this->siteLinkGroups as $group ) { $id = htmlspecialchars( 'sitelinks-' . $group, ENT_QUOTES ); $array[$id] = 'wikibase-sitelinks-' . $group; } @@ -74,7 +98,6 @@ */ protected function getHtmlForSiteLinks( Item $item, $editable = true ) { $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $groups = $wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' ); // FIXME: Inject this $siteLinksView = new SiteLinksView( @@ -86,7 +109,12 @@ $itemId = $item->getId(); -
[MediaWiki-commits] [Gerrit] Inject siteLinkGroups into ItemView - change (mediawiki...Wikibase)
Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/180465 Change subject: Inject siteLinkGroups into ItemView .. Inject siteLinkGroups into ItemView Change-Id: Icd9af0daf0353245eeb73c225dd9121a762d5e98 --- M repo/includes/View/EntityView.php M repo/includes/View/EntityViewFactory.php M repo/includes/View/ItemView.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 5 files changed, 50 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/65/180465/1 diff --git a/repo/includes/View/EntityView.php b/repo/includes/View/EntityView.php index ee53a3b..59731f1 100644 --- a/repo/includes/View/EntityView.php +++ b/repo/includes/View/EntityView.php @@ -45,6 +45,11 @@ */ protected $textInjector; + /** +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +*/ public function __construct( FingerprintView $fingerprintView, ClaimsView $claimsView, diff --git a/repo/includes/View/EntityViewFactory.php b/repo/includes/View/EntityViewFactory.php index 0a942b4..66e76f6 100644 --- a/repo/includes/View/EntityViewFactory.php +++ b/repo/includes/View/EntityViewFactory.php @@ -42,15 +42,22 @@ */ private $sectionEditLinkGenerator; + /** +* @var string[] +*/ + private $siteLinkGroups; + public function __construct( EntityTitleLookup $entityTitleLookup, EntityLookup $entityLookup, - OutputFormatSnakFormatterFactory $snakFormatterFactory + OutputFormatSnakFormatterFactory $snakFormatterFactory, + array $siteLinkGroups ) { $this->entityTitleLookup = $entityTitleLookup; $this->entityLookup = $entityLookup; $this->snakFormatterFactory = $snakFormatterFactory; $this->sectionEditLinkGenerator = new SectionEditLinkGenerator(); + $this->siteLinkGroups = $siteLinkGroups; } /** @@ -78,7 +85,7 @@ // @fixme support more entity types if ( $entityType === 'item' ) { - return new ItemView( $fingerprintView, $claimsView, $language ); + return new ItemView( $fingerprintView, $claimsView, $language, $this->siteLinkGroups ); } elseif ( $entityType === 'property' ) { $displayStatementsOnProperties = WikibaseRepo::getDefaultInstance()->getSettings() ->getSetting( 'displayStatementsOnProperties' ); diff --git a/repo/includes/View/ItemView.php b/repo/includes/View/ItemView.php index 16fd88e..4c2f152 100644 --- a/repo/includes/View/ItemView.php +++ b/repo/includes/View/ItemView.php @@ -3,6 +3,7 @@ namespace Wikibase\Repo\View; use InvalidArgumentException; +use Language; use Wikibase\DataModel\Entity\Item; use Wikibase\EntityRevision; use Wikibase\Repo\WikibaseRepo; @@ -18,6 +19,30 @@ * @author Daniel Werner */ class ItemView extends EntityView { + + /** +* @var string[] +*/ + private $siteLinkGroups; + + /** +* @see EntityView::__construct +* +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +* @param string[] $siteLinkGroups +*/ + public function __construct( + FingerprintView $fingerprintView, + ClaimsView $claimsView, + Language $language, + array $siteLinkGroups + ) { + parent::__construct( $fingerprintView, $claimsView, $language ); + + $this->siteLinkGroups = $siteLinkGroups; + } /** * @see EntityView::getMainHtml @@ -54,8 +79,7 @@ protected function getTocSections() { $array = parent::getTocSections(); $array['claims'] = 'wikibase-statements'; - $groups = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'siteLinkGroups' ); - foreach ( $groups as $group ) { + foreach ( $this->siteLinkGroups as $group ) { $id = htmlspecialchars( 'sitelinks-' . $group, ENT_QUOTES ); $array[$id] = 'wikibase-sitelinks-' . $group; } @@ -74,7 +98,6 @@ */ protected function getHtmlForSiteLinks( Item $item, $editable = true ) { $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $groups = $wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' ); // FIXME: Inject this $siteLinksView = new SiteLinksView( @@ -86,7 +10
[MediaWiki-commits] [Gerrit] Inject siteLinkGroups into ItemView - change (mediawiki...Wikibase)
Thiemo Mättig (WMDE) has submitted this change and it was merged. Change subject: Inject siteLinkGroups into ItemView .. Inject siteLinkGroups into ItemView Change-Id: Icd9af0daf0353245eeb73c225dd9121a762d5e98 --- M repo/includes/View/EntityView.php M repo/includes/View/EntityViewFactory.php M repo/includes/View/ItemView.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 5 files changed, 50 insertions(+), 8 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/View/EntityView.php b/repo/includes/View/EntityView.php index ee53a3b..59731f1 100644 --- a/repo/includes/View/EntityView.php +++ b/repo/includes/View/EntityView.php @@ -45,6 +45,11 @@ */ protected $textInjector; + /** +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +*/ public function __construct( FingerprintView $fingerprintView, ClaimsView $claimsView, diff --git a/repo/includes/View/EntityViewFactory.php b/repo/includes/View/EntityViewFactory.php index 0a942b4..66e76f6 100644 --- a/repo/includes/View/EntityViewFactory.php +++ b/repo/includes/View/EntityViewFactory.php @@ -42,15 +42,22 @@ */ private $sectionEditLinkGenerator; + /** +* @var string[] +*/ + private $siteLinkGroups; + public function __construct( EntityTitleLookup $entityTitleLookup, EntityLookup $entityLookup, - OutputFormatSnakFormatterFactory $snakFormatterFactory + OutputFormatSnakFormatterFactory $snakFormatterFactory, + array $siteLinkGroups ) { $this->entityTitleLookup = $entityTitleLookup; $this->entityLookup = $entityLookup; $this->snakFormatterFactory = $snakFormatterFactory; $this->sectionEditLinkGenerator = new SectionEditLinkGenerator(); + $this->siteLinkGroups = $siteLinkGroups; } /** @@ -78,7 +85,7 @@ // @fixme support more entity types if ( $entityType === 'item' ) { - return new ItemView( $fingerprintView, $claimsView, $language ); + return new ItemView( $fingerprintView, $claimsView, $language, $this->siteLinkGroups ); } elseif ( $entityType === 'property' ) { $displayStatementsOnProperties = WikibaseRepo::getDefaultInstance()->getSettings() ->getSetting( 'displayStatementsOnProperties' ); diff --git a/repo/includes/View/ItemView.php b/repo/includes/View/ItemView.php index 16fd88e..4c2f152 100644 --- a/repo/includes/View/ItemView.php +++ b/repo/includes/View/ItemView.php @@ -3,6 +3,7 @@ namespace Wikibase\Repo\View; use InvalidArgumentException; +use Language; use Wikibase\DataModel\Entity\Item; use Wikibase\EntityRevision; use Wikibase\Repo\WikibaseRepo; @@ -18,6 +19,30 @@ * @author Daniel Werner */ class ItemView extends EntityView { + + /** +* @var string[] +*/ + private $siteLinkGroups; + + /** +* @see EntityView::__construct +* +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +* @param string[] $siteLinkGroups +*/ + public function __construct( + FingerprintView $fingerprintView, + ClaimsView $claimsView, + Language $language, + array $siteLinkGroups + ) { + parent::__construct( $fingerprintView, $claimsView, $language ); + + $this->siteLinkGroups = $siteLinkGroups; + } /** * @see EntityView::getMainHtml @@ -54,8 +79,7 @@ protected function getTocSections() { $array = parent::getTocSections(); $array['claims'] = 'wikibase-statements'; - $groups = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'siteLinkGroups' ); - foreach ( $groups as $group ) { + foreach ( $this->siteLinkGroups as $group ) { $id = htmlspecialchars( 'sitelinks-' . $group, ENT_QUOTES ); $array[$id] = 'wikibase-sitelinks-' . $group; } @@ -74,7 +98,6 @@ */ protected function getHtmlForSiteLinks( Item $item, $editable = true ) { $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $groups = $wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' ); // FIXME: Inject this $siteLinksView = new SiteLinksView( @@ -86,7 +109,12 @@ $itemId = $item->
[MediaWiki-commits] [Gerrit] Inject siteLinkGroups into ItemView - change (mediawiki...Wikibase)
Adrian Lang has uploaded a new change for review. https://gerrit.wikimedia.org/r/176237 Change subject: Inject siteLinkGroups into ItemView .. Inject siteLinkGroups into ItemView Change-Id: Icd9af0daf0353245eeb73c225dd9121a762d5e98 --- M repo/includes/View/EntityView.php M repo/includes/View/EntityViewFactory.php M repo/includes/View/ItemView.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php 5 files changed, 48 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/37/176237/1 diff --git a/repo/includes/View/EntityView.php b/repo/includes/View/EntityView.php index ee53a3b..59731f1 100644 --- a/repo/includes/View/EntityView.php +++ b/repo/includes/View/EntityView.php @@ -45,6 +45,11 @@ */ protected $textInjector; + /** +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +*/ public function __construct( FingerprintView $fingerprintView, ClaimsView $claimsView, diff --git a/repo/includes/View/EntityViewFactory.php b/repo/includes/View/EntityViewFactory.php index 95cd0f5..de04594 100644 --- a/repo/includes/View/EntityViewFactory.php +++ b/repo/includes/View/EntityViewFactory.php @@ -41,15 +41,22 @@ */ private $sectionEditLinkGenerator; + /** +* @var string[] +*/ + private $siteLinkGroups; + public function __construct( EntityTitleLookup $entityTitleLookup, EntityLookup $entityLookup, - OutputFormatSnakFormatterFactory $snakFormatterFactory + OutputFormatSnakFormatterFactory $snakFormatterFactory, + array $siteLinkGroups ) { $this->entityTitleLookup = $entityTitleLookup; $this->entityLookup = $entityLookup; $this->snakFormatterFactory = $snakFormatterFactory; $this->sectionEditLinkGenerator = new SectionEditLinkGenerator(); + $this->siteLinkGroups = $siteLinkGroups; } /** diff --git a/repo/includes/View/ItemView.php b/repo/includes/View/ItemView.php index a3946ef..8b7087f 100644 --- a/repo/includes/View/ItemView.php +++ b/repo/includes/View/ItemView.php @@ -20,6 +20,30 @@ class ItemView extends EntityView { /** +* @var string[] +*/ + private $siteLinkGroups; + + /** +* @see EntityView::__construct +* +* @param FingerprintView $fingerprintView +* @param ClaimsView $claimsView +* @param Language $language +* @param string[] $siteLinkGroups +*/ + public function __construct( + FingerprintView $fingerprintView, + ClaimsView $claimsView, + Language $language, + array $siteLinkGroups + ) { + parent::__construct( $fingerprintView, $claimsView, $language ); + + $this->siteLinkGroups = $siteLinkGroups; + } + + /** * @see EntityView::getMainHtml */ protected function getMainHtml( EntityRevision $entityRevision, array $entityInfo, @@ -55,8 +79,7 @@ protected function getTocSections() { $array = parent::getTocSections(); $array['claims'] = 'wikibase-statements'; - $groups = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'siteLinkGroups' ); - foreach ( $groups as $group ) { + foreach ( $this->siteLinkGroups as $group ) { $id = htmlspecialchars( 'sitelinks-' . $group, ENT_QUOTES ); $array[$id] = 'wikibase-sitelinks-' . $group; } @@ -75,7 +98,6 @@ */ protected function getHtmlForSiteLinks( Item $item, $editable = true ) { $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $groups = $wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' ); // FIXME: Inject this $siteLinksView = new SiteLinksView( @@ -87,7 +109,12 @@ $itemId = $item->getId(); - return $siteLinksView->getHtml( $item->getSiteLinks(), $itemId, $groups, $editable ); + return $siteLinksView->getHtml( + $item->getSiteLinks(), + $itemId, + $this->siteLinkGroups, + $editable + ); } } diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index d4f19b9..2b89aa0 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -972,7 +972,8 @@ $entityViewFactory = new EntityViewFactory( $entityTi