DiscardLayoutChangesForm has no getSectionStorage() method

Created on 10 July 2019, over 5 years ago
Updated 28 January 2024, 11 months ago

In Layout Builder's DiscardLayoutChangesForm, the $sectionStorage is not available for use outside of the class.

An example use case is a form alter (eg. hook_node_layout_builder_form) that for some reason wants getLayoutBuilderUrl() from the $sectionStorage.

Proposed solution is to simply add a getSectionStorage() method, just as OverridesEntityForm has.

I'll supply a patch.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 4 days ago

Created by

πŸ‡ΈπŸ‡ͺSweden johnzzon Gothenburg πŸ‡ΈπŸ‡ͺ

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.

  • πŸ‡³πŸ‡ΏNew Zealand danielveza Brisbane, AU
      /**
       * Retrieves the section storage object.
       *
       * @return \Drupal\layout_builder\SectionStorageInterface
       *   The section storage for the current form.
       */
      public function getSectionStorage() {
        return $this->sectionStorage;
      }
    

    This code is used in 5x places with just a slightly different comment each time. It would be a small trait but it could be worth it to add a new trait that adds the property & the getSectionStorage function. What do people think?

Production build 0.71.5 2024