diff --git a/src/View/Helper/ArchiveSiteMetaViewHelper.php b/src/View/Helper/ArchiveSiteMetaViewHelper.php index 1643a65..c7845f8 100644 --- a/src/View/Helper/ArchiveSiteMetaViewHelper.php +++ b/src/View/Helper/ArchiveSiteMetaViewHelper.php @@ -95,6 +95,23 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper return null; } + public function getSiteImage($site) + { + foreach ($site->pages() as $page) { + foreach ($page->blocks() as $block) { + if ($block->layout() === 'archiveSiteMeta') { + $attachments = $block->attachments(); + //if (!$attachments) { + // return null; + //} + $media = $attachments[0]->item()->media()[0]; + return $media->primaryMedia()->thumbnailUrl('large'); + } + } + } + return null; + } + /** * @return \Omeka\Api\Representation\SiteRepresentation */