getgrav / getgrav/grav-plugin-admin

Using list controls for page collections

Open
#783 11 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

Wasn't sure whether to file this issue here or under plugin-form, so let me know if I should move it.

What I'm trying to do is to set up an admin blueprint that uses a list control to specify a page collection of individual pages. My blueprint looks like this:

``` yml
title: Collection
'@extends': default

form:
fields:
tabs:
type: tabs

fields:
collection:
type: tab
title: Collection

fields:
header.content.items:
type: list
label: Collection
btnLabel: Add project
style: vertical

fields:
.@page.self:
type: pages
label: Page
```

This renders the admin controls correctly, and if I enter the items in a collection manually, the admin panel will render them correctly. However, if I make edits in the admin panel and save, things will trip up on the .@page.self key, and the generated YAML will look something like this:

``` yml
content:
items:
-
'@page':
self: /projects/example
```

How can I prevent @page from becoming an object - ie. how can I make the YAML serializer "escape" the dot in the key name in the admin blueprint?

Contributor guide

Open the contributing guide

Research direction

Start with the admin blueprint's list control, the .@page.self pages field, and the save path that produces YAML. Reproduce the conversion shown in the issue and trace how the key is serialized. Done means saving preserves the literal @page.self key rather than creating a nested @page object.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.