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

View file

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

View file

@ -6,7 +6,7 @@ return function ($site) {
$logoHref = $site->url(); $logoHref = $site->url();
$logoAriaLabel = "Go to {$site->title()}'s home page"; $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( return compact(
'logoAriaLabel', 'logoAriaLabel',
'logoHref', 'logoHref',