makes $page optional
This commit is contained in:
parent
f58b75700c
commit
d2f9c6ae81
|
@ -20,16 +20,18 @@ class HeaderImageViewHelper extends AbstractHelper
|
||||||
* @param SitePageRepresentation
|
* @param SitePageRepresentation
|
||||||
* @return string media url
|
* @return string media url
|
||||||
*/
|
*/
|
||||||
public function getImage($page)
|
public function getImage($page = null)
|
||||||
{
|
{
|
||||||
foreach ($page->blocks() as $block) {
|
if ($page) {
|
||||||
if ($block->layout() === 'headerImage') {
|
foreach ($page->blocks() as $block) {
|
||||||
$attachments = $block->attachments();
|
if ($block->layout() === 'headerImage') {
|
||||||
#if ($$attachments) {
|
$attachments = $block->attachments();
|
||||||
$media = $attachments[0]->item()->media()[0];
|
#if ($$attachments) {
|
||||||
return $media->primaryMedia()->thumbnailUrl('large');
|
$media = $attachments[0]->item()->media()[0];
|
||||||
#}
|
return $media->primaryMedia()->thumbnailUrl('large');
|
||||||
}
|
#}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$site = $this->currentSite();
|
$site = $this->currentSite();
|
||||||
return $this->getView()->getHelperPluginManager()->get('archiveSiteMeta')->getSiteImage($site);
|
return $this->getView()->getHelperPluginManager()->get('archiveSiteMeta')->getSiteImage($site);
|
||||||
|
|
Loading…
Reference in New Issue