From 80662a6c9e4ddec34f71e80fe477af2f46569696 Mon Sep 17 00:00:00 2001 From: buttle Date: Mon, 17 May 2021 22:03:27 +0200 Subject: [PATCH] removes getPageImage. now handled by HeaderImage module --- src/View/Helper/ArchiveSiteMetaViewHelper.php | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/View/Helper/ArchiveSiteMetaViewHelper.php b/src/View/Helper/ArchiveSiteMetaViewHelper.php index c7845f8..4bca045 100644 --- a/src/View/Helper/ArchiveSiteMetaViewHelper.php +++ b/src/View/Helper/ArchiveSiteMetaViewHelper.php @@ -3,12 +3,6 @@ namespace ArchiveSiteMeta\View\Helper; use Laminas\View\Helper\AbstractHelper; -//class ArchiveSiteMeta implements FactoryInterface -//{ - - -#use ArchiveSiteMeta\Service\Form\ConfigFormFactory; - /** * View helper to get metadata for all pages of the specified type. */ @@ -74,36 +68,19 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper { return []; } + /** - * Get the page's meta image url. + * Get the site's meta image url. * - * @param SitePageRepresentation + * @param SiteRepresentation * @return string media url */ - public function getPageImage($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; - } - 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'); } @@ -112,6 +89,26 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper return null; } + /** + * Get the page's meta image url. + * + * @param SitePageRepresentation + * @return string media url + */ + /* + public function getPageImage($page) + { + foreach ($page->blocks() as $block) { + if ($block->layout() === 'archiveSiteMeta') { + $attachments = $block->attachments(); + $media = $attachments[0]->item()->media()[0]; + return $media->primaryMedia()->thumbnailUrl('large'); + } + } + return $this->getSiteImage($page->site()); + } + */ + /** * @return \Omeka\Api\Representation\SiteRepresentation */