Problem/Motivation

Using array_pop/array_push when manipulating sections, transform the key 'layout-builder__section' into a numeric key which breaks other modules integration.

Steps to reproduce

Use UI Styles Layout Builder to add styles to sections. See #3408778: Section styles missing in layout_builder layout editing

Proposed resolution

Preserve key.

CommentFileSizeAuthor
#4 section_library-3416266-4.patch1.71 KBgrimreaper
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Grimreaper created an issue. See original summary.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review
grimreaper’s picture

StatusFileSize
new1.71 KB

Attaching patch for Composer usage.

kevinquillen’s picture

This seems potentially bad for data - are any maintainers around that can look at this one?

hydra’s picture

Status: Needs review » Reviewed & tested by the community

Not a maintainer, but I ran into the same issue a couple times now with other integrations and can confirm that this does work. Not 100% sure about side-effects but I did not ran into any issues with that. Let's give that issue some attention.

grimreaper’s picture

Hi,

In #3490687: Layout Builder: stylize main form/page, I would like to put some default styling for Section Library but that is not possible without the fix. Also without the fix, the styling I put for stuff not related to Section Library are broken.

rajab natshah’s picture

Title: Do not use array_pop or array_push » Switch from useing array_pop/array_push for section manipulation to preserve key integrity and ensure module integration compatibility

rajab natshah’s picture

rajab natshah’s picture

Status: Reviewed & tested by the community » Fixed
rajab natshah’s picture

Title: Switch from useing array_pop/array_push for section manipulation to preserve key integrity and ensure module integration compatibility » Switch from using array_pop/array_push for section manipulation to preserve key integrity and ensure module integration compatibility
rajab natshah’s picture

✅ Released section_library-1.1.2
✅ Released section_library-1.2.1

Thanks, Florent, Kevin, and Pascal, for filing the issue, the MR, and testing!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.