- Issue created by @flyke
- π§πͺBelgium flyke
I tried setting Inline blocks and Custom block types to
Allow all existing & new Custom block types blocks
. After saving, I've got these errors both twice:- User warning: The following theme is missing from the file system: toolbar in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
- Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
When I go to the layout edit page and add a block then, only a few show up, not the ones that I actually want.
- π§πͺBelgium flyke
Not sure if its helpful, this is the devel output for the 'Text' block type. Again: that shows up and works as Promoted block, but I cannot seem to get it shown on the Other tab, just like all my other custom block types.
- π§πͺBelgium flyke
I might have figured it out by copparing modules/contrib/lb_plus/src/Element/LayoutBuilderPlusUI.php to modules/contrib/layout_builder_browser/src/Controller/BrowserController.php on how to list blocks.
Testing this patch in a moment. - πΊπΈUnited States tim bozeman
Hmm strange... If you disable LB+ do you get the results your after in regular Layout Builder? Is it a Layout Builder Restrictions problem? I thought we had it dialed in to where LB+ is acting the same as regular Layout Builder. π€
- π§πͺBelgium flyke
If I disable LB+ then I do get the results I'm after: I see the blocks that I'm missing in lb_plus. BUT this is not form a clean Layout Builder.
I enabled lb_plus for testing in a project that already had lots of layoutbuilder settings and configuration from other contrib modules:- bootstrap_layout_builder
- bootstrap_styles
- layout_builder_blocks
- layout_builder_browser
- layout_builder_modal
- layout_builder_restrictions
So it might be from one of them. I'll see if its possible to test disabling most of those modules in my test project. If I succeed, I will report back.
- π§πͺBelgium flyke
I disabled layout_builder_restrictions, layout_builder_browser, layout_builder_modal.
Without lb_plus: custom inline block types are available
With lb_plus: custom inline block types are not available inside Edit layout -> Add block (+ icon in the bottom bar) -> 'Other' tab.My custom inline blocks are available if I make specific adjustments to lb_plus/src/Element/LayoutBuilderPlusUI.php
If I change this:if ($layout_builder_type === 'layout_block') { // Include fields from the parent entity. $parent_definitions = $this->blockManager->getFilteredDefinitions('layout_builder', $this->getPopulatedContexts($section_storage), [ 'section_storage' => $section_storage, ]); foreach ($parent_definitions as $name => $parent_definition) { if (str_contains($name, 'field_block:')) { $definitions[$name] = $parent_definition; } } }
Into (adding extra new code below):
// Add field blocks. if ($layout_builder_type === 'layout_block') { // Include fields from the parent entity. $parent_definitions = $this->blockManager->getFilteredDefinitions('layout_builder', $this->getPopulatedContexts($section_storage), [ 'section_storage' => $section_storage, ]); foreach ($parent_definitions as $name => $parent_definition) { if (str_contains($name, 'field_block:')) { $definitions[$name] = $parent_definition; } } } // Add custom inline blocks. if ($layout_builder_type === 'entity') { $parent_definitions = $this->blockManager->getFilteredDefinitions('layout_builder', $this->getPopulatedContexts($section_storage), [ 'section_storage' => $section_storage, 'list' => 'inline_blocks', ]); foreach ($parent_definitions as $name => $parent_definition) { if (str_contains($name, 'inline_block:')) { $definitions[$name] = $parent_definition; } } }
If I do that then my custom inline block types are available.
I actually added this bit of code to the MR from #3404515 β¨ Improve Icon Selection/Upload Active because I needed both this fix as well as the icon improvements to set an icon for every block type, not just promoted blocks. And I could not get both to work using a patch for the issue here and an MR for the issue there, so I did not include this patch from this issue in my project and instead only included the MR from #3404515 β¨ Improve Icon Selection/Upload Active which now fixes both problems. Maybe not ideal so any feedback welcome if there is a better way.