Hi all,
would it be possible to extend the system-area in the panel, to show another value.
f.i. a version of the project besides the kirby-version.
Something like the following:
Is there already an object, which we can add properties. Maybe by config?
In the Vue-src of the Panel-Area is an environment-Object, but i think that is encapsulated and not really bound to this environment.
Thx for any hints.
Yes, see Panel areas | Kirby CMS
Maybe it would be sufficient to extend the PHP part of the system view, take a look to see how the data is passed.
ok, thanks @texnixe.
it works so far, but i am wondering if there is an more easy/future proof way…
- i have added a new prop to my config. that will come from
env
later
- i have copied all the content inside
action
from config/areas/system/views.php
to an area plugin
, and add another item to $environment
which has a value from config.
return [
'version' => '1.1.0',
...
];
use Kirby\Cms\App;
use Kirby\Toolkit\I18n;
Kirby::plugin('custom/system-area', [
'areas' => [
'system' => function () {
return [
'views' => [
'system' => [
'action' => function () {
$kirby = App::instance();
$system = $kirby->system();
$updateStatus = $system->updateStatus();
$license = $system->license();
$environment = [
[
'label' => $license ? I18n::translate('license') : I18n::translate('license.register.label'),
'value' => $license ? 'Kirby 3' : I18n::translate('license.unregistered.label'),
'theme' => $license ? null : 'negative',
'dialog' => $license ? 'license' : 'registration'
],
[
'label' => 'Version from Config',
'value' => option('version')
],
...
];
...
return [
'component' => 'k-system-view',
'props' => [
'environment' => $environment,
'exceptions' => $kirby->option('debug') === true ? $exceptions : [],
'plugins' => $plugins,
...
]
do i really have to copy all the action, or does it somehow work to only add an item to $environment
if i remove some other props, the system-area wont display correct, so i guess it is not possible to merge or extend the data. if i add a custom/area-plugin
, it will completely override the original props, isn’t it?
but thank you so far!