From 2b79d762b3891ec198b00a390cfd1a1ee908270c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Nicou=C3=A9?= Date: Wed, 20 Jul 2022 17:05:13 +0200 Subject: [PATCH] Add url based title to each exhibition --- site/controllers/home.php | 16 ++++++++++++++++ site/templates/base.twig | 12 ++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 site/controllers/home.php diff --git a/site/controllers/home.php b/site/controllers/home.php new file mode 100644 index 0000000..c67d4db --- /dev/null +++ b/site/controllers/home.php @@ -0,0 +1,16 @@ +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 + ]; +}; diff --git a/site/templates/base.twig b/site/templates/base.twig index e31e5a8..3bc4ced 100644 --- a/site/templates/base.twig +++ b/site/templates/base.twig @@ -42,14 +42,14 @@