Add support for Layout Builder inline blocks

Created on 29 July 2022, almost 2 years ago
Updated 10 March 2023, over 1 year ago

First—thanks for the excellent module! 👏

Problem/Motivation

Adding a Layout Builder inline block that includes a Headline Group field fails with an ajax error in the console:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /layout_builder/add/block/overrides/node.92546/1/main/inline_block%3Acard
StatusText: parsererror
ResponseText: Error: Call to undefined method Drupal\layout_builder\Form\AddBlockForm::getEntity() in Drupal\headline_group\Plugin\Field\FieldWidget\BaseHeadlineWidget->getParentTitle() (line 141 of /var/www/docroot/modules/contrib/headline_group/src/Plugin/Field/FieldWidget/BaseHeadlineWidget.php).

The error occurs regardless which Headline behavior is selected in the field settings.

Steps to reproduce

  1. Create a custom block type that includes a Headline Group field
  2. Visit/create a node where Layout Builder is enabled
  3. Add a new block to a section
  4. Choose 'Create custom block' and select the block type that includes a Headline Group field

The operation seemingly fails silently—the error above appears in the javascript console.

Proposed resolution

Modify the getParentTitle() method to retrieve the entity from the section storage context in the Layout Builder context.

Remaining tasks

Merge request to follow.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States justcaldwell

Live updates comments and jobs are added and updated live.
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.69.0 2024