getgrav / getgrav/grav-plugin-admin
Header data causes error on saving
- Dominant language
- PHP
- Stars
- 377
- Forks
- 225
- Avg merge
- 11h 51m
- Merged PRs (30d)
- 4
Description
Hi All,
I'm struggling with a form collecting some custom header data and not properly saving it.
Error message on Admin page, after attempting to save: `Failed to save entry: Bad form data for field collection 'site': string used instead of an array`
**Context**:
Based on the [Learn Grav cookbook recipes](https://learn.getgrav.org/16/cookbook/general-recipes#create-a-private-area) I'm establishing a private area on my site. I've created a group "Private",
```
Private:
access:
site:
private: true
readableName: Private
description: 'Private User'
enabled: true
```
Pages, that are exclusively for this group, then have this in their frontmatter - and it works fine.
```
access:
site.private: true
```
**Reproducing the problem**
Now, for each page created I want to make sure, the editors can choose in the backend, whether the page is Private or not.
I've created a blueprint for the content type:
```
extends@: default
form:
fields:
tabs:
fields:
newtab: # Create new tab
type: tab
title: Custom Settings
ordering@: content # attaching it right to the content tab
fields:
privacy:
type: section
title: Privacy Settings
underline: true
fields:
header.access.site.private:
type: toggle
toggleable: true
label: Test - access.site.private
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
```
This results in a form, that works fine.

Ticking the box results in this frontmatter entry, which seems fine for me.
```
---
title: 'Privacy Test 2'
access:
site:
private: true
---
```
Now - anytime I try to save the file again, edits or not, I get shown the error code above and the file is not saved again.

Any pointers? Where is my mistake? What am I missing? (Also, is this a Admin Plugin issue? Where would be the right place to ask?)
Super grateful for any help - thanks a lot!!!
Contributor guide
Assessment
This issue has not been assessed yet.