Hi all,
Does anybody have an idea if it’s possible to use options in routes in a plugin? I keep getting the defaults from the plugin, tried using ready
, system.loadPlugins:after
but nothing works .
Below an example, so I want to be able to overwrite the slugs via the site/config.php
. So i keep getting the once defined in the plugin, no matter what I do in site/config.php
.
<?php
Kirby::plugin('my/plugin', [
'options' => [
'slug' => [
'nl' => 'nieuws',
'en' => 'news',
'fr' => 'actualites',
]
],
'routes' => function($kirby) {
$newsUri = $kirby->option("my.plugin.slug.{$kirby->language()}", "news");
return [
[
'pattern' => "{$newsUri}/(:any)",
'action' => function($any) {
if(!empty($any))
{
$page = page("dbnews/{$any}");
if(empty($page))
{
go('error');
}
return $page->render();
}
go('error');
},
'method' => 'GET',
],
];
},
]);
Any ideas?