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

Modular page with complex collection exception

admin

Started by Toomas Laik 8 years ago · 0 replies · 502 views
8 years ago

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:
[code]
Twig_Error_Runtime
An exception has been thrown during the rendering of a template ("Array to string conversion").
[/code]

The error happens at line 69 in user/plugins/admin/themes/grav/templates/forms/field.html.twig
[code]
{% 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 %}
[/code]

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):
[code]

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: $

    [/code]

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'.
[code]
items:

  • '@page.modular': '/playlist'
  • '@page.modular': '/player'
    [/code]

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:
[code]

taxonomy:
category:

  • js
    tag:
  • player_playlist

{% do assets.addJs('player-playlist-js') %}
{{ assets.js() }}
[/code]

"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.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
3 101 9 hours ago
Support · by Anna, 3 days ago
2 98 1 day ago
Support · by Justin Young, 1 day ago
1 66 1 day ago
Support · by Duc , 1 week ago
2 101 6 days ago
Support · by Colin Hume, 1 week ago
2 94 6 days ago