I’m having trouble getting the admin plugin to save changes to arrays, i.e. type: list
. I can add items just fine, but modifying or deleting them via admin plugin doesn’t work — except in the advanced mode. The list blueprint snippet here:
— yaml
Hmm… not sure that looks pretty much accurate. I just compared it to the features modular page blueprint as provided by antimatter theme:
features:
type: tab
title: Features
fields:
header.features:
name: features
type: list
label: Features
fields:
.icon:
type: text
label: Icon
.header:
type: text
label: Header
.text:
type: text
label: Text
I confirmed i was able to add, then save, then remove a new item in a Modular features page.
perhaps you can create an issue: https://github.com/getgrav/grav-plugin-admin/issues and provide steps we can use to reproduce it exactly.
Thanks @rhukster! I was using Appi theme in this particular test. I’ll investigate more.
It’s something to do with how I extend a blueprint. I’ll need to do some more experimenting to see if it’s something I do or if it’s a bug
Ok, returning to this
As I said above, I’m having trouble removing or editing list items in the admin.
To add a global option on the Admin tool’s Pages/Options tab I’ve created the file /themes/mytheme/blueprints/default.yaml
with this content:
title: Default
extends@:
- type: default
form:
fields:
tabs:
type: tabs
active: 1
fields:
options:
fields:
header:
type: section
title: Header
underline: true
fields:
header.nav_hidden:
type: toggle
label: Hide navigation
highlight: 0
default: 0
options:
1: 'Yes'
0: 'No'
validate:
type: bool
header.header_transparent:
type: toggle
label: Transparent header
highlight: 0
default: 0
options:
1: 'Yes'
0: 'No'
validate:
type: bool
header.nav_bright:
type: toggle
label: White logo and links
highlight: 0
default: 0
options:
1: 'Yes'
0: 'No'
validate:
type: bool
If I remove the above file editing/deleting list items works fine. Is that a bug or am I somehow adding global items wrong? In case it’s a bug I already posted an issue on GH as well.
Seems like when I change the line13 header:
to something else editing/removal starts working again.
Also note that there is a current issue with Blueprint list-fields: #1285, wherein a temporary fix is adding array: true
.
i think header:
might well be causing confusion to Grav as it already has a page.header
variable.
Thanks all! Yes, the docs state this pretty clearly — I’ve probably started to edit the line to header.custom_page_options:
, but got distracted. So essentially I’m blaming the kids.