Advanced Panel Area: Default field value in create dialog


I’m following along this receipe, which works very well so far – thanks for that! =)

I’d like to add a toggle field with a default value of true to the fields array in
but when I open the ‘create’ dialog, the default value is ignored (still false).
What am I missing?
Thanks in advance!

/* /site/plugins/products/dialogs/fields.php */
use Kirby\Products\Product;
use Kirby\Toolkit\A;

return [
    'confirm' => [
        'label' => 'Confirmation',
        'type' => 'toggle',
        'default' => true,
        'text' => [
            false => 'nope',
            true => 'japp'

I just checked, if defaults of other field types would work, but they don’t.
Though it’s possible to store default values in the create method of the Product.php class, it would be nice to also have it visually in the panel view.
Any help would be much appreciated. :pray:t3:

Can’t help from the top of my head, unfortunately, and would have to look into it more in-depth (tonight).

1 Like

Well, this is still open:

So, if it’s related the issue is at least “known”.

1 Like

Thanks Roman,
I didn’t know about this issue, but it seems to be related to my problem.
I will patiently wait for a fix then :slight_smile:

That looks like it is related, indeed.

It´s an older topic but just stumbled over the same problem and the solution is in the related github Issue. So maybe its easier or helfpul if the solution is also shown here :wink:

'component' => 'k-form-dialog',
    'props' => [
       'value' => [
            'title' => $page->title()->value(),
            'slug'  => $page->slug(),
            'defaultTest' => 'Hello World'

1 Like