- Issue created by @magtak
My setup looks like this:
Node has a layout_paragraphs field which serves as the main content field.
Authors can add paragraphs using the "experimental" LP field widget.
There are paragraphs that render drupal blocks and
There are blocks that contain their own layout_paragraphs field with the same setup as the node above.
The logic is to allow the use of the same UI to create reusable blocks that can be used in content throughout the site.
So, to recap, Node -> paragraphs -> blocks -> paragraphs
With this setup when trying to reoder paragraphs within the blocks I face an issue where the AJAX request
/layout-paragraphs-builder/{$parent_builder_uuid}/reorder?_wrapper_format=drupal_ajax
... uses the ID of the outer layout_paragraphs builder, the one that belongs to the node which results in a 404 with the following message:
'The "layout_paragraphs_layout" parameter was not converted for the path "/layout-paragraphs-builder/{layout_paragraphs_layout}/reorder" (route name: "layout_paragraphs.builder.reorder")'
Mimic the setup above and try to reorder paragraphs in your block using the front-end tool.
I traced this down to Drupal.behaviors.layoutParagraphsBuilder and specifically this
$(once('lpb-events', '[data-lpb-id]')).on(events, function (e) {
var $element = $(e.currentTarget);
updateUi($element);
});
It seems that e.currentTarget is always the outer layout_builder whereas e.target is the builder that was clicked, as such I switched to:
$(once('lpb-events', '[data-lpb-id]')).on(events, function (e) {
var $element = $(e.target);
updateUi($element);
});
... and reordering now seems to be working as expected.
Active
2.0
Code