fixes null attachment bug
This commit is contained in:
parent
e999f52e86
commit
c736f6d3ff
|
@ -45,14 +45,7 @@ class HeaderImage extends AbstractBlockLayout
|
|||
$form = $this->formElementManager->get(HeaderImageBlockForm::class);
|
||||
$form->prepare();
|
||||
|
||||
$html = '';
|
||||
$html .= $view->blockAttachmentsForm($block);
|
||||
//$html .= '<a href="#" class="collapse" aria-label="collapse"><h4>';
|
||||
//$html .= $view->translate('Options'). '</h4></a>';
|
||||
//$html .= '<div class="collapsible" style="padding-top:6px;">';
|
||||
//$html .= $view->formCollection($form);
|
||||
//$html .= '</div>';
|
||||
return $html;
|
||||
return $view->blockAttachmentsForm($block);
|
||||
}
|
||||
|
||||
public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
|
||||
|
|
|
@ -25,8 +25,10 @@ class HeaderImageViewHelper extends AbstractHelper
|
|||
foreach ($page->blocks() as $block) {
|
||||
if ($block->layout() === 'headerImage') {
|
||||
$attachments = $block->attachments();
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
return $media->primaryMedia()->thumbnailUrl('large');
|
||||
if ($$attachments) {
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
return $media->primaryMedia()->thumbnailUrl('large');
|
||||
}
|
||||
}
|
||||
}
|
||||
$site = $this->currentSite();
|
||||
|
|
Loading…
Reference in New Issue