From e17f0beaa0e8be73b119441fe05c43fdbb080978 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 7 Feb 2025 16:59:46 +0100 Subject: [PATCH] allow to set `data-*` attributes on modal --- CHANGELOG.md | 4 ++++ src/core/Resources/assets/js/modules/modal.js | 22 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf8ec1..ed8328c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +## [v1.25.2] - 2025-02-07 +### Added +* allow to set `data-*` attributes on modal + ## [v1.25.1] - 2024-05-13 ### Added * add drag&drop in the block builder diff --git a/src/core/Resources/assets/js/modules/modal.js b/src/core/Resources/assets/js/modules/modal.js index 29bf260..427d024 100644 --- a/src/core/Resources/assets/js/modules/modal.js +++ b/src/core/Resources/assets/js/modules/modal.js @@ -1,12 +1,14 @@ const $ = require('jquery') -const openModal = function (url, createModal) { +const openModal = function (url, createModal, dataAttributes) { if (createModal) { var id = 'modal-container-' + parseInt(Math.floor(Math.random() * 1000)) } else { var id = 'modal-container' } + dataAttributes = dataAttributes ?? [] + let container = $(`#${id}`) const body = $('body') const doTrigger = true @@ -15,6 +17,10 @@ const openModal = function (url, createModal) { const doTrigger = false container = $(`