I'm trying to use this module in conjunction with the Layout Builder Modal module, but I'm getting the following error when trying to load a node's layout page: "Argument 1 passed to Drupal\Component\Utility\UrlHelper::buildQuery() must be of the type array, null given, called in /var/www/web/core/modules/contextual/contextual.module on line 180". I believe it's happening because this module (lb_ux) is moving the contextual links to a different position in the render array when it's building the administrative section, and then the layout_builder_modal module is trying to alter the non-existent contextual links at it's prior location.
I'm not sure what the best approach to resolving this would be, but one I've come up with is to move the code currently in LayoutBuilderUX::buildAdministrativeSection() to a preprocess function, and then altering the weight of this preprocess function so that it runs last. This way, other modules can still adjust contextual links.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3106939-7.patch | 12.25 KB | i.mcbride |
| #4 | interdiff-3-4.txt | 12.22 KB | piggito |
| #4 | 3106939-4.patch | 12.22 KB | piggito |
Comments
Comment #2
rromore commentedComment #3
piggito commentedRe-rolled patch
Comment #4
piggito commentedCurrent approach isn't right yet cause we get
Warning: Invalid argument supplied for foreach() in Drupal\layout_builder_modal\LayoutBuilderModal::preRenderContextual()in this line https://git.drupalcode.org/project/layout_builder_modal/-/blob/8.x-1.x/s...This error is caused by the fact that we move layout_builder preRender along with lb_ux preRender logic after any other pre_render function but layout_builder_modal expects layout_builder's preRender to add layout_builder key in build array.
IMO we should isolate lb_ux's preRender as a pre_render callback and use hook_module_implements_alter to make this pre_render run as last in the list.
Attached patch implements this proposal, please let me know if you agree on this approach and mb we can update issue summary.
Comment #5
piggito commentedFor those who need it I'm also attaching a patch including the fix in The "cog" icon to edit block settings doesn't display when "Show content preview" is disabled
Comment #6
piggito commentedPlease ignore the last patch including The "cog" icon to edit block settings doesn't display when "Show content preview" is disabled cause I found that the patch in that issue wasn't ready yet (see https://www.drupal.org/project/lb_ux/issues/3116402#comment-13631976)
I'm also hiding the file to avoid highlighting it.
Review and further work should go on patch at #4
Comment #7
i.mcbride commentedThis is a reroll of #4 that will apply against the Drupal 11 compatible version of the module.