Layouts with underscores in their ID don't appear on limit config page

Created on 20 February 2024, 9 months ago

Problem/Motivation

When switching from layout_paragraphs_restriction to layout_paragraphs_limit, I noticed not all layouts enabled on /admin/config/content/layout_paragraphs/sections were appearing on /admin/config/content/layout_paragraphs/limit.
Upon further investigation, it appeared that those with underscores in their ID were the ones that weren't appearing and after changing the underscores to colons, clearing cache and enabling them on /admin/config/content/layout_paragraphs/sections, they did appear on /admin/config/content/layout_paragraphs/limit.
I then tried adding & enabling both variations to confirm this was the factor, and the limit config page did indeed only show the ones with colons, not the ones with underscores.

Steps to reproduce

- Create a custom theme with a layouts.yml file as follows:

one_column:
  label: 'Single'
  category: 'Custom Layouts'
  template: templates/layouts/layout--onecol
  default_region: main
  regions:
    content:
      label: Main content
  icon_map:
    - [rectangle_vertical]
1:1:2:
  label: '1:1:2 (colons)'
  category: 'Custom Layouts'
  template: templates/layouts/layout--1_1_2
  default_region: first
  regions:
    first:
      label: First Column
    second:
      label: Second Column
    third:
      label: Third Column
  icon_map:
    - [first_column, second_column, third_column, third_column]
1_1_2:
  label: '1:1:2 (underscores)'
  category: 'Custom Layouts'
  template: templates/layouts/layout--1_1_2
  default_region: first
  regions:
    first:
      label: First Column
    second:
      label: Second Column
    third:
      label: Third Column
  icon_map:
    - [first_column, second_column, third_column, third_column]

- Enable all 3 on /admin/config/content/layout_paragraphs/sections
- Go to /admin/config/content/layout_paragraphs/limit and observe how only "Single" and "1:1:2 (colons)" appear.

Additional info

I added dsm($paragraph_types) on line 70 of LayoutParagraphsLimitSettingsForm.php and noticed the array keys of $paragraph_types->section->behavior_plugins->layout_paragraphs->available_layouts were missing the underscores. As in: the array keys were "112" instead of "1_1_2" (where the ones with colons were untouched), yet the one with ID "one_column" was also untouched, so the issue seems to be a combination of numbers and underscores or something...

This is probably an issue with ParagraphsType::loadMultiple(), but I'm logging it here since the layouts sections config page doesn't seem to suffer from this issue. My apologies if this is not the right place.

🐛 Bug report
Status

Active

Version

1.0

Component

User interface

Created by

🇧🇪Belgium seutje Antwerp

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

Comments & Activities

Production build 0.71.5 2024