diff --git a/assets/src/modules/Action.js b/assets/src/modules/Action.js index 01a22ce1eb..c5e6b3016b 100644 --- a/assets/src/modules/Action.js +++ b/assets/src/modules/Action.js @@ -107,14 +107,14 @@ export default class Action { // Add action buttons if needed let popupContainerId = popup.containerId; let popupContainer = document.getElementById(popupContainerId); + if (!popupContainer) return false; - let featureIdInputSelector = 'div.lizmapPopupContent input.lizmap-popup-layer-feature-id'; - Array.from(popupContainer.querySelectorAll(featureIdInputSelector)).map(element => { - // Get layer id and feature id - let val = element.value; - let featureId = val.split('.').pop(); - let layerId = val.replace('.' + featureId, ''); + Array.from(popupContainer.querySelectorAll('div.lizmapPopupContent .lizmapPopupSingleFeature')).map(element => { + + // Get layer ID and feature ID + const featureId = element.dataset.featureId; + const layerId = element.dataset.layerId; // Get layer lizmap config let getLayerConfig = mainLizmap.lizmap3.getLayerConfigById(layerId); diff --git a/lizmap/modules/lizmap/lib/Request/WMSRequest.php b/lizmap/modules/lizmap/lib/Request/WMSRequest.php index b348fd40b1..248a7cf7ae 100644 --- a/lizmap/modules/lizmap/lib/Request/WMSRequest.php +++ b/lizmap/modules/lizmap/lib/Request/WMSRequest.php @@ -701,6 +701,8 @@ protected function gfiVectorXmlToHtml($layerId, $layerName, $layerTitle, $layer, ++$layerFeaturesCounter; // Hidden input containing layer id and feature id + // TODO Deprecated, it will be removed later + // Use data-attributes in the parent div instead $hiddenFeatureId = ''.PHP_EOL; $popupFeatureContent = $this->getViewTpl('view~popupDefaultContent', $layerName, $layerId, $layerTitle, array( diff --git a/lizmap/modules/view/templates/popup.tpl b/lizmap/modules/view/templates/popup.tpl index aedea6cdb6..b1b262b855 100644 --- a/lizmap/modules/view/templates/popup.tpl +++ b/lizmap/modules/view/templates/popup.tpl @@ -1,4 +1,4 @@ -