Syntax change : '#' in layout content regions

Created on 30 October 2024, 2 months ago

Problem/Motivation

In our projects, we use the layout system from Drupal.
Consequently, we use the layout templates in our UI Examples pages, for example in mypage.ui_examples.yml :

id: 'mypage'
label: 'My page'
render:
  - '#theme': layout__mytheme
    top_full:
      - '#type': pattern
        '#id': heading
        '#fields':
          title: 'Page title'

And the layout template (layout--mytheme.html.twig) looks like that :

{#
/**
 * @file
 * Template for mytheme layout.
 */
#}

{% set classes = [
  'layout--' ~ layout.id|clean_class|default('mytheme'),
] %}

{% if content %}
  <div{{ attributes.addClass(classes) }}>

    <div class="top-full">
      {{ content.top_full }}
    </div>
  </div>
{% endif %}

This was working until the #3414730 changes : but now, in the examples pages, content.top_full is null so nothing is rendered.
After investigating, it seems that the data sent is now content['#top_full'] : this differs from the expected syntax when using layouts in Drupal.

Questions

  • Is this easily fixable ?
  • Or is our use of layout with UI Examples a "special case" or should be done differently ?
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France mh_nichts

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024