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()
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3041763-5-PASS.patch | 3.38 KB | phenaproxima |
| #5 | 3041763-5-FAIL.patch | 2.36 KB | phenaproxima |
| #3 | 3041763-3.patch | 1.02 KB | phenaproxima |
Comments
Comment #2
phenaproximaThis 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.
Comment #3
phenaproximaHere's the fix. I'll try to add a test.
Comment #4
mark_fullmerThanks 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.
Comment #5
phenaproximaHere's a test! The fail patch is the interdiff.
Comment #7
mark_fullmer