Hi there again!
Sorry to bother you but I just ran into another problem!
I am currently trying to create a custom panel page.
However, while creating the form (listed below), I get the following error:
Method StructureField::__toString() must not throw an exception, caught Error: Call to a member function structure() on null
It seems the structure field is not possible to use out of the box in my custom form. Is there any other way to create something alike or make this work?
forms/config.php:
<?php // /site/plugins/plugin-name/forms/config.php
return function() {
$form = new Kirby\Panel\Form(array(
'headertitle' => array(
'label' => 'Plantenbeheer',
'type' => 'headline',
'icon' => 'flower'
),
'plant' => array(
'label' => 'Plantencollectie',
'type' => 'structure',
'style' => 'table',
'fields' => array(
'name' => array(
'label' => 'Naam',
'type' => 'text',
'width' => '1/4'
),
'latinname' => array(
'label' => 'Latijnse naam',
'type' => 'text',
'width' => '1/2'
),
'height' => array(
'label' => 'Hoogte',
'type' => 'number',
'width' => '1/4'
),
'colour' => array(
'label' => 'Kleur',
'type' => 'text',
'width' => '1/2'
),
'bloomingperiod' => array(
'label' => 'Bloeiperiode',
'type' => 'text',
'width' => '1/2'
),
'stock' => array(
'label' => 'Voorraad',
'type' => 'number',
'width' => '1/4'
),
'price' => array(
'label' => 'Prijs',
'type' => 'Number',
'width' => '1/4',
'icon' => 'euro'
),
'image' => array(
'label' => 'Plaatje',
'type' => 'image',
'width' => '1/2'
),
'comment' => array(
'label' => 'Opmerking',
'type' => 'text',
),
'description' => array(
'label' => 'Beschrijving',
'type' => 'textarea'
)
)
)
));
$form->attr('autocomplete', 'off');
$form->data('autosubmit', 'native');
$form->style('centered');
$form->buttons->submit->value = 'Sla wijzigingen op';
return $form;
};
Thanks for your help!