Removed deprecated manual merges of default site controller data with specific controller data

This commit is contained in:
Paul Nicoué 2025-07-11 14:55:58 +02:00
parent 0fefc5e2e1
commit 7bc8cd51c0
3 changed files with 11 additions and 23 deletions

View file

@ -1,18 +1,12 @@
<?php
return function ($kirby, $site) {
// Get shared data from default controller (site.php)
$shared = $kirby->controller('site' , compact('site'));
return function ($site) {
// Get CV field content
$cv = $site->cv();
// Return merged arrays containing shared data and current controller data
return A::merge(
$shared,
compact(
'cv',
)
// Return cv controller data
return compact(
'cv',
);
};

View file

@ -1,9 +1,6 @@
<?php
return function ($kirby, $site) {
// Get shared data from default controller (site.php)
$shared = $kirby->controller('site' , compact('site'));
return function ($site) {
// Get CV page URL and override logo href and aria-label attributes
$logoHref = page('cv')->url();
@ -12,13 +9,10 @@ return function ($kirby, $site) {
// Get items from image gallery structure field
$galleryItems = $site->image_gallery()->toStructure();
// Return merged arrays containing shared data and current controller data
return A::merge(
$shared,
compact(
'galleryItems',
'logoAriaLabel',
'logoHref',
)
// Return home controller data
return compact(
'galleryItems',
'logoAriaLabel',
'logoHref',
);
};

View file

@ -6,7 +6,7 @@ return function ($site) {
$logoHref = $site->url();
$logoAriaLabel = "Go to {$site->title()}'s home page";
// Return data
// Return general site controller data (merged by default with data from specific controllers)
return compact(
'logoAriaLabel',
'logoHref',