Hello,
I have a weird problem with modular pages when using complex collections. They throw a consistent exception when trying to view them in the admin panel:
Twig_Error_Runtime
An exception has been thrown during the rendering of a template ("Array to string conversion").
The error happens at line 69 in user/plugins/admin/themes/grav/templates/forms/field.html.twig
{% block prepend %}{% endblock prepend %}
<input
{# required attribute structures #}
name="{{ field_name }}"
value="{{ value|join(', ') }}" <- This line
{% if field.key %}
data-key-observe="{{ (scope ~ field_name)|fieldName }}"
{% endif %}
Oddly enough, this page works just fine when viewed on the website, like a regular visitor would see it.
If it helps - I’m using a custom, rather simple theme - based on template created with grav tool, and it’s mostly just customized CSS. I haven’t changed anything manually in system files.
My modular page definition (modular.md):
---
title: Some Title
content:
items:
- '@taxonomy':
category: js
tag: player_playlist
- '@taxonomy':
category: music
tag: player
body_classes: modular
twittercardoptions: summary
articleenabled: false
musiceventenabled: false
orgaenabled: false
orga:
ratingValue: 2.5
orgaratingenabled: false
eventenabled: false
personenabled: false
restaurantenabled: false
restaurant:
priceRange: $
---
I also tried options like referring to modular pages under several normal pages, like the following code - and ended up with exact same error. The only time the page is displayed in admin panel is with simple one-line option like ‘@self.modular’ or ‘@page.modular’.
items:
- '@page.modular': '/playlist'
- '@page.modular': '/player'
I double-checked that taxonomy info is defined in all the pages I need. Assets for “player-playlist-js” are also defined and verified to load. Example from page with playlist scripts:
---
taxonomy:
category:
- js
tag:
- player_playlist
---
{% do assets.addJs('player-playlist-js') %}
{{ assets.js() }}
“player” page contains a lot of HTML so I’ll leave it out. The taxonomies are also defined there like in this page.
I tried looking up this error in a similar situation without any results. Hope someone will have some idea about what’s going on here.