Skip to content
Snippets Groups Projects
Commit 2e05f448 authored by Justin Toupin's avatar Justin Toupin
Browse files

Issue #3281169: Incorrect region is passed when clicking "+" after moving a...

Issue #3281169: Incorrect region is passed when clicking "+" after moving a component from one region to another
parent 68656737
No related branches found
No related tags found
2 merge requests!103Issue #3295875: Add a new dedicated permission for Layout paragraphs configurations,!83Issue #3281169: Incorrect region is passed when clicking "+" after moving a component from one region to another
......@@ -88,6 +88,14 @@ class ChooseComponentController extends ControllerBase {
'sibling_uuid' => $request->query->get('sibling_uuid', NULL),
'placement' => $request->query->get('placement', NULL),
];
// If inserting a new item adjecent to a sibling component, the region
// passed in the URL will be incorrect if the existing sibling component
// was dragged into another region. In that case, always use the existing
// sibling's region.
if ($query_params['sibling_uuid']) {
$sibling = $layout_paragraphs_layout->getComponentByUuid($query_params['sibling_uuid']);
$query_params['region'] = $sibling->getRegion();
}
$types = $this->getAllowedComponentTypes($layout_paragraphs_layout, $query_params['parent_uuid'], $query_params['region']);
// If there is only one type to render,
// return the component form instead of a list of links.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment