I am trying to integrate fields into my custom section like we’re used to in blueprints in general. it is working with simple fields like text
, date
, number
and so on but not with more complex fields like pages, select, multiselect, etc.
- for the pages field I get the following error when I click on it to select pages:
this.endpoints is undefined
- for the select field I get the following error right away:
this.options.forEach is not a function
- for the multiselect field I get the following error right away:
Sortable:
elmust be an HTMLElement, not [object Comment]
Please tell me what else I need to load/integrate to make this work.
blueprint
sections:
foo:
type: fooexample
headline: Foo
fields:
date:
label: Date
type: date
width: 1/3
pages:
label: Pages
type: pages
select:
label: Select
type: select
options: query
query: site.index
multiselect:
type: multiselect
options:
design: Design
architecture: Architecture
photography: Photography
3d: 3D
web: Web
index.js
window.panel.plugin('plugins/fooexample', {
sections: {
fooexample: {
template: `
<section class="k-fooexample-section">
<k-label>{{ headline }}</k-label>
<k-form
:fields="fields"
/>
</section>
`,
data: function () {
return {
headline: null,
fields: {},
};
},
created: function () {
this.load()
.then(response => {
this.headline = response.headline;
this.fields = response.fields;
});
}
}
}
});
index.php
Kirby::plugin('plugins/fooexample', [
'sections' => [
'fooexample' => [
'props' => [
'headline' => function(string $headline = null)
{
return $headline ?? 'Untitled';
},
'fields' => function(array $fields = null)
{
return $fields ?? [];
},
],
],
],
]);