Merge gallery and exhibitions pages into home page

This commit is contained in:
Paul Nicoué 2022-09-27 16:32:06 +02:00
parent e1654494b3
commit b45fe42a45
13 changed files with 4945 additions and 224 deletions

27
site/controllers/home.php Normal file
View file

@ -0,0 +1,27 @@
<?php
return function ($page) {
// Get exhibitions field content (stored as yaml) and parse it to return an array
$exhibitions = $page->exhibitions()->yaml();
// Add url based title to each exhibition
foreach ($exhibitions as &$exhibition) {
$exhibition['title'] = str_replace(['http://', 'https://', 'www.'], '', $exhibition['url']);
}
// Get contact fields content
$email = $page->email();
$instagram = $page->instagram();
// Get image files section content
// $images = $page->files()->template("full_screen_image")->sortBy('sort');
$images = $page->files()->template("full_screen_image")->shuffle();
return [
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram,
'images' => $images
];
};