From 6c80e28116011a299ee4fdd1fd3e940802ca11b0 Mon Sep 17 00:00:00 2001
From: Ankit Kumar <krankitjha@gmail.com>
Date: Sun, 6 Apr 2025 11:39:44 +0530
Subject: [PATCH] Fix null getSection()

---
 src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php b/src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php
index d33f78f..20ef5b8 100644
--- a/src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php
+++ b/src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php
@@ -57,7 +57,8 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface {
     ) {
 
       // Pull out the layout_builder_id from config.
-      $layout_builder_id = $event->getFormState()->getFormObject()->getCurrentComponent()->get('layout_builder_id');
+      $layout_builder_id = $form['#form_id'] === 'layout_builder_update_block'
+          ? $event->getFormState()->getFormObject()->getCurrentComponent()->get('layout_builder_id') : NULL;
 
       // Add the section id to the configure form.
       $form['settings']['layout_builder_id'] = [
-- 
GitLab