adds getSiteImage function
This commit is contained in:
parent
ed7118bb96
commit
411b86a3fd
|
@ -95,6 +95,23 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
|
||||||
return null;
|
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
|
* @return \Omeka\Api\Representation\SiteRepresentation
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue