julienmonnerie/site/controllers/exhibitions.php
2022-09-09 15:26:04 +02:00

26 lines
697 B
PHP

<?php
return function ($site, $page) {
// Get home page object
$homePage = $site->homePage();
// 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();
return [
'homePage' => $homePage,
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram
];
};