julienmonnerie/site/controllers/exhibitions.php

27 lines
697 B
PHP
Raw Normal View History

2022-07-20 17:05:13 +02:00
<?php
2022-07-28 18:59:14 +02:00
return function ($site, $page) {
2022-09-09 15:26:04 +02:00
// Get home page object
$homePage = $site->homePage();
2022-07-20 17:05:13 +02:00
2022-09-09 15:26:04 +02:00
// Get exhibitions field content (stored as yaml) and parse it to return an array
$exhibitions = $page->exhibitions()->yaml();
2022-07-20 17:05:13 +02:00
2022-09-09 15:26:04 +02:00
// Add url based title to each exhibition
foreach ($exhibitions as &$exhibition) {
$exhibition['title'] = str_replace(['http://', 'https://', 'www.'], '', $exhibition['url']);
}
2022-07-20 17:05:13 +02:00
2022-09-09 15:26:04 +02:00
// Get contact fields content
$email = $page->email();
$instagram = $page->instagram();
2022-07-21 17:20:07 +02:00
2022-09-09 15:26:04 +02:00
return [
'homePage' => $homePage,
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram
];
2022-07-20 17:05:13 +02:00
};