Using item_list in examples break rendering

Created on 9 June 2025, 26 days ago

Problem/Motivation

As for UI patterns (Issue #3529153 ) since v1.0.2, we have error on example pages using theme: item_list

<!--break-->

Error in the navigator :

Le site Web a rencontré une erreur inattendue.

Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template (""type" is an invalid render array key. Value should be an array but got a string.") in "customer:layout" at line 11. in Twig\Template->yield() (line 11 of themes/custom/customer/components/layout/layout.twig).

template_preprocess_item_list()
call_user_func_array() (Line: 261)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 484)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 77)
__TwigTemplate_ea68831567b6bbe1d179b4905979d5a4->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 141)
__TwigTemplate_03c9ed99ec99034085d3fa3357192c92___2130353984->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 44)
__TwigTemplate_03c9ed99ec99034085d3fa3357192c92->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 358)
Twig\Template->display() (Line: 373)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 234)
Drupal\Core\Template\TwigEnvironment->renderInline() (Line: 54)
Drupal\Core\Render\Element\InlineTemplate::preRenderInlineTemplate()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 875)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)

Steps to reproduce

  1. Use theme: item_list in an example
    Example :
    id: 'page-list-example'
    category: list
    enabled: true
    label: 'List example'
    render:
      - theme: item_list
        list_type: ul
        items:
          - type: html_tag
            tag: p
            value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ...'
          - type: html_tag
            tag: p
            value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ...'
          - type: html_tag
            tag: p
            value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ...'
        
  2. Open your example page in navigator

Proposed resolution

This bug also concerns UI Patterns v2.0.4

Our temporary solution is to prefix items content with #

For example :

- type: html_tag
  tag: p
  value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ...'

became :

- '#type': html_tag
  '#tag': p
  '#value': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ...'

Is there a better solution ?

Thanks in advance for your help and feedback

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France malikah

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024