julienmonnerie/site/controllers/exhibitions.php
2022-07-21 17:20:07 +02:00

22 lines
539 B
PHP

<?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();
return [
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram
];
};