Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Filepicker/pagemediaselect returns empty

Started by Morten 8 years ago · 1 replies · 945 views
8 years ago

Hi there,
I'm having some trouble with filepicker and pagemediaselect.
When I pick multiple images using 'pagemediaselect' the form returns empty. But when looking at the frontmatter the files are there, and it's rendered on the website. The same goes for filepicker. I've tried with validate: commalist - but it doesn't work eater.

Picking images:
00|690x94

After saving:
31|690x80

YAML
          fields:
            .headline:
             title: headline
             type: text
             label: Headline
            .images:
              type: pagemediaselect
              preview_images: true
              label: Images
              multiple: true
              validate:
                type: array
8 years ago

Hi,

I'm having an issue as well.
but in my case I can get the following error on save:

TWIG
Twig_Error_Runtime
An exception has been thrown during the rendering of a template ("Array to string conversion").
    /Applications/MAMP/htdocs/bbq/user/plugins/admin/themes/grav/templates/forms/fields/filepicker/filepicker.html.twig

{% embed "forms/fields/select/select.html.twig" %}

    {% block input %}
        {% if not field.options and value %}
            {% set field = field|merge({options: {(value): value}}) %}
        {% endif %}
        {{ parent() }}
    {% endblock %}

    {% block global_attributes %}
        data-grav-filepicker
        data-name="{{field.name}}"
        {% if field.preview_images %}data-preview-images{% endif %}
        data-value="{{value}}"
        {{ parent() }}
    {% endblock %}
{% endembed %}

and if I set the validation type to commalist I get the same error.

Am I missing something?

And here is yaml

YAML
header.gallery-four:
  type: pagemediaselect
  preview_images: true
  label: Images
  multiple: true
  validate:
    type: commalist

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
1 48 1 day ago
Forms & Blueprints · by TomW, 1 month ago
3 339 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 560 1 month ago
Forms & Blueprints · by FrViPofm, 2 months ago
5 575 2 months ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2564 9 months ago