julienmonnerie/site/controllers/home.php
2022-07-20 17:05:13 +02:00

16 lines
397 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']);
}
return [
'exhibitions' => $exhibitions
];
};