julienmonnerie/site/controllers/home.php

30 lines
890 B
PHP
Raw Normal View History

<?php
2022-11-25 14:17:23 +01:00
return function ($site) {
// Get exhibitions field content (stored as yaml) and parse it to return an array
2022-11-25 14:17:23 +01:00
$exhibitions = $site->exhibitions()->yaml();
// Add url based title to each exhibition
foreach ($exhibitions as &$exhibition) {
2022-12-19 15:18:38 +01:00
$exhibition['title'] = str_replace(['http://', 'https://', 'www.', '.html'], '', $exhibition['url']);
2022-11-24 17:16:07 +01:00
$exhibition['title'] = rtrim($exhibition['title'], '/');
}
// Get contact fields content
2022-11-25 14:17:23 +01:00
$email = $site->email();
$instagram = $site->instagram();
$portfolio = $site->portfolio()->toFile();
// Get image files section content
2022-11-25 14:17:23 +01:00
$images = $site->files()->template("full_screen_image")->shuffle();
return [
'exhibitions' => $exhibitions,
'email' => $email,
'instagram' => $instagram,
'portfolio' => $portfolio,
'images' => $images
];
};