diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezobjectrelationlist.js b/src/bundle/Resources/public/js/scripts/fieldType/ezobjectrelationlist.js index f258d10d03..c8bab7a840 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezobjectrelationlist.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezobjectrelationlist.js @@ -87,6 +87,7 @@ const itemNodeNameCell = itemNode.querySelector('.ibexa-relations__item-name'); itemNode.dataset.contentId = contentId; + itemNode.dataset.locationId = locationId; itemNode.querySelector('.ibexa-relations__table-action--remove-item').addEventListener('click', removeItem, false); itemNodeNameCell.dataset.ibexaUpdateContentId = contentId; @@ -128,9 +129,15 @@ }; const openUDW = (event) => { event.preventDefault(); - + const selectedItemsRow = fieldContainer.querySelectorAll(SELECTOR_ROW); const config = JSON.parse(event.currentTarget.dataset.udwConfig); const limit = parseInt(event.currentTarget.dataset.limit, 10); + const selectedLocations = [...selectedItemsRow].reduce((locationsIds, selectedItemRow) => { + const { locationId } = selectedItemRow.dataset; + const parsedLocationId = parseInt(locationId, 10); + + return isNaN(parsedLocationId) ? locationsIds : [...locationsIds, parsedLocationId]; + }, []); const title = limit === 1 ? Translator.trans( @@ -151,6 +158,7 @@ onCancel: closeUDW, title, startingLocationId, + selectedLocations, ...config, multiple: isSingle ? false : selectedItemsLimit !== 1, multipleItemsLimit: selectedItemsLimit > 1 ? selectedItemsLimit - selectedItems.length : selectedItemsLimit, diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig index d25c88d7b2..ba127be78a 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig @@ -170,7 +170,10 @@ {% set body_rows = body_rows|merge([{ cols: body_row_cols, class: 'ibexa-relations__item', - attr: { 'data-content-id': relation.contentInfo.id }, + attr: { + 'data-content-id': relation.contentInfo.id, + 'data-location-id': relation.contentInfo.mainLocationId, + }, }]) %} {% elseif relation.unauthorized %} {% set col_raw_unauthorised %} @@ -194,7 +197,10 @@ { content: col_raw_order_input, raw: true, attr: { class: 'ibexa-relations__order-wrapper' } } ], class: 'ibexa-relations__item', - attr: { 'data-content-id': relation.contentId }, + attr: { + 'data-content-id': relation.contentId, + 'data-location-id': relation.contentInfo.mainLocationId, + }, }]) %} {% endif %} {% endfor %}