mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +00:00
XW-1478 | extendImageData has to be run even for the first PI
This commit is contained in:
parent
1fa29ea03b
commit
10f96eaa96
|
@ -54,7 +54,6 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
wfProfileIn( __METHOD__ );
|
||||
|
||||
$helper = new PortableInfoboxRenderServiceHelper();
|
||||
$dataBag = \Wikia\PortableInfobox\Helpers\PortableInfoboxDataBag::getInstance();
|
||||
$infoboxHtmlContent = '';
|
||||
$heroData = [ ];
|
||||
|
||||
|
@ -88,8 +87,7 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
}
|
||||
}
|
||||
|
||||
// In Mercury SPA content of the first infobox's hero module is already rendered in the article header.
|
||||
if ( !empty( $heroData ) && !( $helper->isMercury() && empty( $dataBag->isFirstInfoboxAlredyRendered() ) ) ) {
|
||||
if ( !empty( $heroData ) ) {
|
||||
$infoboxHtmlContent = $this->renderInfoboxHero( $heroData ) . $infoboxHtmlContent;
|
||||
}
|
||||
|
||||
|
@ -104,7 +102,7 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
$output = '';
|
||||
}
|
||||
|
||||
$dataBag->setFirstInfoboxAlredyRendered( true );
|
||||
\Wikia\PortableInfobox\Helpers\PortableInfoboxDataBag::getInstance()->setFirstInfoboxAlredyRendered( true );
|
||||
|
||||
wfProfileOut( __METHOD__ );
|
||||
|
||||
|
@ -162,6 +160,10 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
private function renderInfoboxHero( $data ) {
|
||||
$helper = new PortableInfoboxRenderServiceHelper();
|
||||
|
||||
// In Mercury SPA content of the first infobox's hero module has been moved to the article header.
|
||||
$firstInfoboxAlredyRendered = \Wikia\PortableInfobox\Helpers\PortableInfoboxDataBag::getInstance()
|
||||
->isFirstInfoboxAlredyRendered();
|
||||
|
||||
if ( array_key_exists( 'image', $data ) ) {
|
||||
$image = $data[ 'image' ][ 0 ];
|
||||
$image[ 'context' ] = self::MEDIA_CONTEXT_INFOBOX_HERO_IMAGE;
|
||||
|
@ -169,15 +171,15 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
$data[ 'image' ] = $image;
|
||||
|
||||
if ( !$helper->isMercury() ) {
|
||||
$markup = $this->renderItem( 'hero-mobile-wikiamobile', $data );
|
||||
} else {
|
||||
$markup = $this->renderItem( 'hero-mobile', $data );
|
||||
return $this->renderItem( 'hero-mobile-wikiamobile', $data );
|
||||
} elseif ( $firstInfoboxAlredyRendered ) {
|
||||
return $this->renderItem( 'hero-mobile', $data );
|
||||
}
|
||||
} else {
|
||||
$markup = $this->renderItem( 'title', $data[ 'title' ] );
|
||||
} elseif ( !$helper->isMercury() || $firstInfoboxAlredyRendered ) {
|
||||
return $this->renderItem( 'title', $data[ 'title' ] );
|
||||
}
|
||||
|
||||
return $markup;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue