Undefined index: label when editing Layout Builder section

Created on 15 January 2020, almost 5 years ago
Updated 19 January 2024, 11 months ago

Problem/Motivation

This issue introduced the ability to add administrative labels to Layout Builder sections:

https://www.drupal.org/project/drupal/issues/3073872 β†’

However, the code assumes the administrative label field has a value. When editing a section which was created before this code was introduced, this results in an AJAX error and the section edit form doesn't load. This error appears in log:

Notice: Undefined index: label in Drupal\layout_builder\Form\ConfigureSectionForm->buildForm() (line 114 of /app/web/core/modules/layout_builder/src/Form/ConfigureSectionForm.php).

Added error from other if you don't receive the first error:
Notice: Undefined index: label in Drupal\layout_builder\Form\MoveBlockForm->buildForm() (line 126 of /web/core/modules/layout_builder/src/Form/MoveBlockForm.php)

Steps to reproduce

  1. Do a Standard install
  2. Enable layout_builder
  3. Enable layout_builder_test (see this link β†’ about test modules)
  4. Configure Basic Page to use Layout Builder for default display
  5. Go to manage layout (/admin/structure/types/manage/page/display/default/layout)
  6. Click "Add Section" and select "Layout Without Label" and insert at the top of the layout.
  7. Click "Configure Section 1"
  8. Navigate to the Recent Log Messages (/admin/reports/dblog) and find Notice: Undefined index: label in Drupal\layout_builder\Form\ConfigureSectionForm->buildForm() (line 118 of /var/www/html/core/modules/layout_builder/src/Form/ConfigureSectionForm.php)
  9. Then find the Body block in Section 2 of the layout and click the "Move Block" contextual link.
  10. Navigate to recent log messages and see
    Notice: Undefined index: label in Drupal\layout_builder\Form\MoveBlockForm->buildForm() (line 129 of /var/www/html/core/modules/layout_builder/src/Form/MoveBlockForm.php)</li>
      <li>

Proposed resolution

TBA

Remaining tasks

Evaluate the fix
Code review

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/A

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 2 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

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.

Production build 0.71.5 2024