Open bnjmnhssnn opened 2 years ago
I was able to get this test setup working by changing the pagemediaselect field name in the blueprint from
.image_2
to header.bar.image_2
.
However, this is not a solution when the elements field is nested in another list field. I believe a final solution should work inside lists and also with partial blueprints and include@
I ran into the exact issue @bnjmnhssnn predicted in his second post.
While nesting filepicker (or pagemedia) in elements OR list is possible, nesting them in elements IN a list is not. A warning message «Not found» appears in the top right corner. (Tested in Grav v1.7.33 w/ Admin v1.10.33.1)
form:
fields:
tabs:
fields:
content:
fields:
content:
unset@: true
header.list:
type: list
label: List
style: vertical
fields:
.name:
type: text
label: Name
.pagemedia:
type: pagemediaselect
label: Pagemediaselect in List
preview_images: true
.file:
type: filepicker
folder: 'page://images/'
label: Filepicker in List
preview_images: true
accept:
- .jpg
- .png
.type:
type: elements
label: 'Type'
size: small
default: text_only
options:
text_only: Text only
text_and_image: Text and image
fields:
text_only:
type: element
fields:
.text:
type: text
label: Text (One)
text_and_image:
type: element
fields:
.text:
type: text
label: Text (Two)
.file:
type: filepicker
folder: 'page://images/'
label: Filepicker in List in Elements
preview_images: true
accept:
- .jpg
- .png
.pagemedia:
type: pagemediaselect
label: Pagemediaselect in List in Elements
preview_images: true
I am running into this exact problem with a pagemedia selected inside an elements nested in a list. Anyone else find a workaround for this? Any reason it shouldn't work since the payloads are the same? Gonna try with the include@ method maybe that will someone fix it.
Edit: Just tried wrapping my elements section in a partial blueprint and using include@ but it still results in the same 404 Not Found Error for pagemediaselect
I have an issue when nesting e pagemediaselect form field inside an elements form field. This is my test setup to repoduce the issue, tested with Grav (1.7.33):
Clicking the first, working pagemediaselect input triggers an ajax request to:
The payload looks like this:
This works fine and the admin panel responds with the expected JSON:
Clicking the second, nested pagemediaselect input triggers an ajax request to the same URL:
The payload is structured exactly like the one triggered by the un-nested pagemediaselect:
Strangely, this does not work, although the request URL and payload are not different: