getgrav / getgrav/grav-plugin-admin

'type: filepicker' not working inside plugin

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

Description

EDIT: After digging around a bit more, and talking with the devs it looks like an issue with filepicker inside list elements on plugins. Added screenshots at the end.

I made a simple admin plugin addon that gets the blueprint of a page and builds a form so you can modify the frontmatter file of that page folder to help editors speed up multilanguage setups, but neither *type: pagemediaselect* or _type: filepicker_ work, giving me a prompt in admin saying that **'Cannot use "self@" outside pages'**.

![image](https://user-images.githubusercontent.com/23484394/156316823-a08790c8-9232-4ae9-83bc-84bfe3e0a503.png)

The issue is I'm not using *self@* anywhere on my theme blueprints, neither on the plugin, the folder: is set to *theme://images/icons*.
```yaml
.image:
type: filepicker
folder: 'theme://images/icons'
preview_images: true
label: MYTHEME.FORM.MENUITEM_ICON
```
It is inside a list element. I placed another filepicker field outside of one to test, and it gave the same error, not working either.

On a clean install it doesn't work either, but doesn't throw an error.
![image](https://user-images.githubusercontent.com/23484394/156320948-1afb41da-8017-4d6b-b952-013b2a1995bf.png)

I tried using it on the plugin blueprint itself, and it worked as expected
![image](https://user-images.githubusercontent.com/23484394/156317622-55b934a2-7433-4e47-bc49-0f331840370f.png)

*type: mediapicker* does work but it only finds images uploaded to page folders, not the theme or *user://images*, which is what I need.

I've been using the latest version of both Grav, Forms and Admin plugin since the start.
I'm working on a windows 10 machine, and tried using both **bin/grav server** and xampp apache server.

EDIT:
Screenshots when adding elements with filepicker to a list inside the plugin
Adding new element
![image](https://user-images.githubusercontent.com/23484394/157276639-680bbba2-e96a-4377-a781-38697d3ab905.png)
After saving it empty once it works normally
![image](https://user-images.githubusercontent.com/23484394/157276725-3188787b-9f77-4a74-83dd-c1e66fa90cfa.png)
But every new element still doesn't work
![image](https://user-images.githubusercontent.com/23484394/157276800-0d5f5688-7215-42c3-86aa-2ffeeaa8c02d.png)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in a clean Grav Admin setup with a filepicker inside a plugin list element, comparing it with the working plugin blueprint field. The payload names no source files or tests, so trace the Admin plugin's filepicker and list-element handling until theme:// or user:// selections work reliably; done means new and saved list elements no longer show the self@ error or empty picker.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
content, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.