grav-plugin-admin icon indicating copy to clipboard operation
grav-plugin-admin copied to clipboard

Admin->config->system throws exception when using "content_fallback: { en: [] }"

Open pamtbaau opened this issue 4 years ago • 2 comments

With the following system.yaml:

languages:
  ...
  content_fallback: { en: [] }

Accessing page http://dev-dev/admin/config/system in Admin throws the following error:

An exception has been thrown during the rendering of a template ("Array to string conversion"). …/user/plugins/admin/themes/grav/templates/forms/field.html.twig88

The following configs works fine:

languages:
  ...
  content_fallback: { en: '' }  # or { en: ['en', 'fr' ]}

The comments in /system/config/system.yaml suggests to use an array:

content_fallback: {}                           # Custom language fallbacks. eg: {fr: ['fr', 'en']}

Note: When saving the setting in Admin, it saves it as a string

  content_fallback:
    en: 'en,fr'

pamtbaau avatar Dec 04 '21 11:12 pamtbaau

I can confirm that empty array [] throws. I think this shouldn't really be ever an array though and just a comma separated string list.

Maybe it is the documentation being not accurate.

w00fz avatar Feb 04 '22 22:02 w00fz

It was a bug in the list field. It was taking the whole value en: 'en,fr' instead of the value of the list item: 'en,fr'`.

mahagr avatar Feb 07 '22 09:02 mahagr