i am trying to create a custom dropdown for files in extending the core lists of dropdowns and dialogs. but i am somewhat stuck to get it work. i can get the dropdown to work but i dont know how to create the dialog properly with fields and link that to a model and the dropdown entry.
<?php
use Kirby\Cms\Find;
Kirby::plugin('XXX/plugin', [
'areas' => [
'site' => function ($kirby) {
return [
'dialogs' => [
'colspan' => [
'load' => function (string $id, string $filename) {
$file = Find::file($id, $filename);
return [
'component' => 'k-form-dialog',
'props' => [
// field definition for the form dialog
'fields' => [
// TODO:
],
// the prefilled model data
'value' => [
'colspan' => $file->colspan()->value(),
],
]
];
},
// https://getkirby.com/docs/reference/plugins/extensions/panel-dialogs#dialog-definition__submit-callback
'submit' => function (string $id) {
return true;
}
]
],
'dropdowns' => [
'page.file' => function (string $id, string $filename) {
$file = Find::file($id, $filename);
$dropdown = $file->panel()->dropdown();
$dropdown[] = '-';
$dropdown[] = [
'icon' => 'grid-top',
'text' => 'Spaltenbreite',
'dialog' => 'colspan'
];
return $dropdown;
}
]
];
},
]
]);