After removing a field form a layout a fatal error is produced in the translation

Created on 26 February 2019, over 5 years ago
Updated 8 April 2024, about 2 months ago

Problem/Motivation

This is a rare issue but it causes a lot of confusion to site builders.

Steps to reproduce:

  1. You need a multi-language site.
  2. Use layout builder to define a layout.
  3. Render any field, for example, field_text_intro. (Label: introduction)
  4. Save the layout.
  5. Translate the label of the field (for example Introducciรณn in spanish)
  6. Then edit the layout builder and remove the field_text_intro from it
  7. When visiting the node in spanish /es/node/1 you will see a fatal error.

The log will indicate:

TypeError: Argument 4 passed to Drupal\layout_builder\SectionComponent::__construct() must be of the type array, null given

The problem is that the translation system adds the translation as a configuration, so when layout builder tries to render the fields it finds something like:

In LayoutBuilderEntityViewDisplayStorage::mapFromStorageRecords()

Which doesn't include a uuid or any other valid data, but the label translation.

Proposed resolution

Decide on a solution:

  • Remove the translation from the configuration when removing a field, OR
  • Check if the uuid of a component is available before trying to render it.

Remaining tasks

  • Write the patch.
  • Add tests.

User interface changes

None.

API changes

None.

Data model changes

None.

๐Ÿ› Bug report
Status

Closed: cannot reproduce

Version

11.0 ๐Ÿ”ฅ

Component
Layout builderย  โ†’

Last updated about 11 hours ago

Created by

๐Ÿ‡ฆ๐Ÿ‡ทArgentina dagmar Argentina

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    This came up as a daily target.

    Tried replicating following the steps in the IS but was not able to get the error.

    If it's still an error could the IS be updated please.

  • Status changed to Closed: cannot reproduce about 2 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand DanielVeza Brisbane, AU

    No major updates to this issue since 2019. 7 months ago the issue could not be reproduced and there has been no further updates or replication steps added.

    Because of that I'm marking the issue as closed. Feel free to reopen or open a new issue if this can be replicated in the future. Thanks!

Production build 0.69.0 2024