Is there any way I can pass isOpen() with custom routes?
My route code
<?php
Kirby::plugin('mg/routes', [
'routes' => [
[
'pattern' => 'team/(:any?)',
'action' => function($arguments) {
$arguments = $this->arguments();
return page('subpage/team')->render([
'arguments' => $arguments,
]);
},
],
],
'controllers' => [
'team' => function ($kirby, $site, $page, $arguments) {
$person = page('subpage/seminare')->index()->findBy('slug', $arguments[0]);
return [
'person' => $person
];
},
],
],
);
In my navigation template
<?php if($item->slug() == 'team'): ?>
<?php $children = page('subpage/seminare')->children()->template("contactperson")->listed(); ?>
<ul>
<?php foreach($children as $child): ?>
<li><a<?php e($child->isOpen(), ' class="Selected mm-listitem mm-listitem--selected"') ?> href="<?= $item->url() ?>/<?= $child->slug() ?>"><?= $child->title()->html() ?></a></li>
<?php endforeach ?>
</ul>