Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Filepicker/pagemediaselect returns empty

Started by Morten 7 years ago · 1 replies · 692 views
7 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
7 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 Ton Haarmans, 5 years ago
13 1144 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago