grav-plugin-admin icon indicating copy to clipboard operation
grav-plugin-admin copied to clipboard

dot in blueprint key

Open dani-ooo opened this issue 3 years ago • 6 comments

i’m making a blueprint for collections for @page.pages only, as a list field like so:

header.content.items:
  type: list
  fields:
    [email protected]:
      type: pages

but this produces:

content:
  items:
    -
      '@page':
        page: /slug

which then doesn’t work for the templates.

i’ve tried different ways of escaping it, getting different results, but none of them working. a couple of examples:

  • .'@page.page':
content:
  items:
    -
      '''@page':
        'page''': /slug
content:
  items:
    -
      '''[@page':
        page: /slug
  • .[@page.page]:
content:
  items:
    -
      '[@page':
        page: /slug

doing it as a single value field, with [email protected] / header.content.items[@page.page], gives similar results.

is this the intended behavior? is there a way to achieve this, or a workaround?

dani-ooo avatar May 12 '22 22:05 dani-ooo

Umm, that looks wrong. What are you trying to do? The collections are defined by data, not by blueprint.

mahagr avatar May 13 '22 06:05 mahagr

the blueprint is for the form to ask for the data, so say the first code i’m referring to is in /blueprints/pages/collection.yaml, and the result i’m talking about is in /pages/slug/collection.md.

dani-ooo avatar May 13 '22 14:05 dani-ooo

Alright. So you need to implement this in a bit different way. Maybe use the list field where you can choose the key and value / list of values.

mahagr avatar May 14 '22 09:05 mahagr

yeah, no. i tried that too before, but the array field doesn’t allow multiple values with the same key; so, if i try to add multiple @page.pages, only the last one in the list is saved. and i also would like the user to be able to just select a page from a list — the array field consists of textfields only.

either way, i believe the problem i’m presenting here is something that should be addressed?

dani-ooo avatar May 14 '22 14:05 dani-ooo

yeah, no. i tried that too before, but the array field doesn’t allow multiple values with the same key; so, if i try to add multiple @page.pages, only the last one in the list is saved. and i also would like the user to be able to just select a page from a list — the array field consists of textfields only.

either way, i believe the problem i’m presenting here is something that should be addressed?

you want dropdown select instead textfields?

mdestafadilah avatar Oct 06 '22 07:10 mdestafadilah

Duplicate of #783?

hughbris avatar Nov 11 '22 00:11 hughbris