getgrav / grav-plugin-form

Grav Form Plugin

Home Page:http://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select Field not saving in plugin options in admin

jgonyea opened this issue · comments

tl;dr: Select form field saving is broken if multiple is set

I'm attempting to add a multiple select to my plugin configuration blueprints.yaml file. In my file, I add the following:

    page_types:
      type: select
      size: long
      classes: fancy
      label: 'Page Types'
      help: 'Page types to be considered as assignable to group content.  Has CRUD implications for selected content.'
      options:
        default: 'Default - based on folder name'
        folder: 'Folder - based on prefix-less folder name'
        title: 'Title - based on title field in header'
        date: 'Date - based on date field in header'
      multiple: true
      validate.type: array

as a sibling of enabled. Viewing the admin configuration of the plugin displays the select field as expected, and I can select multiple options. After pressing save, the field "page_types" is saved in the user/config/plugins/PLUGINNAME.yaml as page_types: '' (e.g. with no data).

Browser: Firefox (Win x64)

PHP 7.4.26
Grav 1.7.30
Form 5.1.6
Admin 1.10.30

Seems that the validate.type: array is not working properly. If that option is broken onto multiple lines like:

vaidate:
  type: array

then the saving works properly. The Learn site should be updated to reflect this.

Thanks to Djamil on Discord for finding the issue.

@mahagr is this a valid issue or is it a deprecated usage of dot-chained properties? If that's the case can you update the docs, as it appears to be misleading with the information.

If not a bug, @jgonyea kindly provided a PR for this: getgrav/grav-learn#973

It's just a documentation issue.