julienmonnerie/site/controllers/home.php

28 lines
799 B
PHP
Raw Normal View History

<?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']);
2022-11-24 17:16:07 +01:00
$exhibition['title'] = rtrim($exhibition['title'], '/');
}
// Get contact fields content
$email = $page->email();
$instagram = $page->instagram();
// Get image files section content
$images = $page->files()->template("full_screen_image")->shuffle();
return [
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram,
'images' => $images
];
};