Hi,
I want to find out why my closure (function()-return) approach in my php-blueprints do not work! When I use this approach my blueprint is not loaded but the default page blueprint is used… It’s only when I use an array type of return my blueprint (page) is used ie visible. Just want to understand why!
Thanks in advance!
Non working blueprint:
<?php
// Load the helper functions from our plugin
require_once kirby()->plugin('padeltime/mymanager')->root() . '/helpers.php';
return function ($page) {
return [
'title' => 'Clubs Section',
'icon' => 'archive',
'columns' => [
'main' => [
'width' => '1/1',
'sections' => [
'clublist' => [
'headline' => 'Clubs',
'type' => 'pages',
'template' => 'club',
'info' => "Players: {{ page.children.filterBy('template', 'player').count }} | Lessons: {{ page.children.filterBy('template', 'lesson').count }}",
'query' => 'page.getVisibleClubs',
'create' => checkPermission('create', 'club')
]
]
]
]
];
};
Working php-bleuprint version:
<?php
// Load the helper functions from our plugin
require_once kirby()->plugin('padeltime/mymanager')->root() . '/helpers.php';
return [
'title' => 'Clubs Section',
'icon' => 'archive',
'columns' => [
'main' => [
'width' => '1/1',
'sections' => [
'clublist' => [
'headline' => 'Clubs',
'type' => 'pages',
'template' => 'club',
'info' => "Players: {{ page.children.filterBy('template', 'player').count }} | Lessons: {{ page.children.filterBy('template', 'lesson').count }}",
'query' => 'page.getVisibleClubs',
'create' => checkPermission('create', 'club')
]
]
]
]
];