Provide access to protected properties in ConfigureSectionForm through getter methods

Created on 5 May 2025, 5 days ago

Problem/Motivation

Currently, the $isUpdate and $delta properties in the ConfigureSectionForm class are marked as protected, and no public getter methods are available to access them.

This becomes problematic in scenarios where developers need to alter the Layout Builder Configure Section form using hook_form_layout_builder_configure_section_alter(). Access to these properties is often necessary to implement custom behavior based on whether the form is in update mode or to determine the section's delta.

Since the properties are protected and not exposed via getters, contrib modules are forced to rely on workarounds to access this information.

This feature request is partially inspired by #3044117

Proposed resolution

Contrib modules resolve these problems using different workarounds:

    Layout Builder Lock: #3497055
    Layout Builder Extras - Live Update: #3348710

Adding simple public getter methods for $isUpdate and $delta would provide a clean, consistent, and forward-compatible solution that improves DX (developer experience) and avoids the need for fragile or hacky code in contrib or custom modules.

For example, solution from LB Extras - Live Updates: https://git.drupalcode.org/project/layoutbuilder_extras_live_update/-/me...

Remaining tasks

  1. Update ConfigureSectionForm
  2. Update LayoutBuilderTest
✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

layout_builder.module

Created by

πŸ‡ΊπŸ‡¦Ukraine Panchuk Volyn, Lutsk

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024