Steps to reproduce:

Install Layout Library and Layout Builder Restrictions.
Navigate to admin/structure/layouts and click "Add layout"
Give it a Label and select any entity/bundle from the drop down
Add a section to the layout
From within the section, click "Add block"

Result:
The spinner will appear for a second and then go away. If you inspect the console, you'll see an Uncaught Drupal.AjaxError. Checking the error log, you'll see something like this:

Call to undefined method Drupal\layout_library\Plugin\SectionStorage\Library::getThirdPartySetting() in layout_builder_restrictions_plugin_filter_block__layout_builder_alter()

Comments

balsama created an issue. See original summary.

phenaproxima’s picture

Project: Lightning Layout » Layout Builder Restrictions
Version: 8.x-2.x-dev » 8.x-1.x-dev
Issue summary: View changes

This is an incompatibility between Layout Builder Restrictions and Layout Library.

The problem is this line in layout_builder_restrictions_plugin_filter_block__layout_builder_alter():

$allowed_blocks = $default->getThirdPartySetting('layout_builder_restrictions', 'allowed_blocks', []);

This assumes that the default section storage is the core Defaults plugin, which implements ThirdPartySettingsInterface. When Layout Library is installed, this assumption is not necessarily true. So we need to fix that, and test it.

There's already precedent for this in Layout Builder Restrictions -- namely in layout_builder_restrictions_plugin_filter_layout__layout_builder_alter(), where the default storage is checked for ThirdPartySettingsInterface.

phenaproxima’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new1.02 KB

Here's the fix. I'll try to add a test.

mark_fullmer’s picture

Thanks for catching this, @phenaproxima. As you point out, this is the same issue as https://www.drupal.org/project/layout_builder_restrictions/issues/3032415, but for the layout. Will review & test shortly.

phenaproxima’s picture

Issue tags: -Needs tests
StatusFileSize
new2.36 KB
new3.38 KB

Here's a test! The fail patch is the interdiff.

mark_fullmer’s picture

Assigned: Unassigned » mark_fullmer
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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