Compatibility with Re-usable Layout Builder Blocks

Created on 27 February 2024, 9 months ago
Updated 12 March 2024, 8 months ago

Apologies in advance for posting a patch that is only needed if you have another core patch applied. I'm hoping it will help someone else facing the same issue and maybe can be considered if and when the core patch is accepted 🙏

If anyone, like me, has been using Add reusable option to inline block creation Needs review for reusable Layout Builder blocks, you'll probably notice the following error when trying to add a content block:

Call to a member function getSection() on null in Drupal\layout_builder\Form\ConfigureBlockFormBase->getCurrentSection()

This is because the patch in question adds a first step to the form to allow the user to choose an Inline vs Reusable block. This change delays setting the section storage and component until step two, but Layout Builder Block's form alter doesn't know about it so it errors out when trying to run `$form_object->getCurrentComponent()`.

The attached patch simply checks that we're on step 2 of the "Add Block" form before running the form alter code.

Note: This patch is only needed if you are using Add reusable option to inline block creation Needs review . Do not apply this patch if you don't have that core patch applied or the styles won't be applied!

📌 Task
Status

Postponed

Version

1.1

Component

Code

Created by

🇨🇦Canada drclaw

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

Comments & Activities

Production build 0.71.5 2024