From c43772315a1888d57d6e41283fcc1cb45962842c Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 13 Feb 2023 15:31:00 +0100 Subject: [PATCH] chg: [genericTemplates:toggle] Added support of confirm modal --- templates/genericTemplates/toggle.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/templates/genericTemplates/toggle.php b/templates/genericTemplates/toggle.php index 426249c..ab36c91 100644 --- a/templates/genericTemplates/toggle.php +++ b/templates/genericTemplates/toggle.php @@ -1 +1,14 @@ -Form->postLink(__('Toggle'), ['action' => 'toggle', $entity->id, $fieldName], ['confirm' => __('Are you sure you want to toggle {0} of {1}?', $fieldName. $entity->id)]) ?> \ No newline at end of file +Form->postLink(__('Toggle'), ['action' => 'toggle', $entity->id, $fieldName], ['confirm' => __('Are you sure you want to toggle `{0}` of {1}?', h($fieldName), h($entity->id))]); +$formHTML = sprintf('
%s
', $form); +$bodyHTML = $formHTML; + +$modalOptions = [ + 'title' => __('Are you sure you want to toggle `{0}` of {1}?', h($fieldName), h($entity->id)), + 'type' => 'confirm', + 'bodyHtml' => $bodyHTML, +]; + +echo $this->Bootstrap->modal($modalOptions); +?> \ No newline at end of file