From 5613b649acd7306fe85a9419bceb72c244accbed Mon Sep 17 00:00:00 2001 From: Laurent Lienher Date: Fri, 28 Jul 2023 16:23:49 +0200 Subject: [PATCH] Use metadata to select what column use for popup selection in edition --- src/editing/editFeatureComponent.js | 8 +++++++- src/themes.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/editing/editFeatureComponent.js b/src/editing/editFeatureComponent.js index c9386d983740..e4aaaf447157 100644 --- a/src/editing/editFeatureComponent.js +++ b/src/editing/editFeatureComponent.js @@ -1283,7 +1283,13 @@ Controller.prototype.openFeatureMenu_ = function (coordinate, features) { /** @type {import('ngeo/Menu').MenuActionOptions[]} */ const actions = []; features.forEach((feature) => { - const label = feature.get('name') ? feature.get('name') : feature.getId(); + let label = null; + const selectionName = this.editableTreeCtrl.node.metadata['editingSelectionAttribute']; + if (selectionName) { + label = feature.get(selectionName); + } else { + label = feature.get('name') ? feature.get('name') : feature.getId(); + } /** @type {import('ngeo/Menu').MenuActionOptions} */ const choice = { cls: '', diff --git a/src/themes.js b/src/themes.js index 3b1cea00591c..98ac3ee7eb24 100644 --- a/src/themes.js +++ b/src/themes.js @@ -228,6 +228,8 @@ * @property {string} [iconUrl] The URL of the icon to display in the layer tree. For every kind of layer. * @property {string} identifierAttributeField The field used in the 'display query window' as feature title. * For WMS layers. + * @property {string} editingSelectionAttribute The field used in the selector tooltip to name the layer when multiple ones are selected on the map. + * For WMS layers. * @property {boolean|undefined} [isChecked=false] Is the layer checked by default. For WMS and WMTS layers. * @property {boolean|undefined} [isExpanded=false] Whether the layer group is expanded by default. For * layer groups (only).