From bdcf057608d7592de4b6fd084e1de0328a58a066 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 2 Dec 2022 09:48:09 +0100 Subject: [PATCH] chg: [genericTemplate:confirm] Usage of BootstrapHelper\Modal --- templates/genericTemplates/confirm.php | 67 +++++++++++++++----------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/templates/genericTemplates/confirm.php b/templates/genericTemplates/confirm.php index 6428f6c..9910adf 100644 --- a/templates/genericTemplates/confirm.php +++ b/templates/genericTemplates/confirm.php @@ -1,28 +1,39 @@ - - +element('genericElements/Form/genericForm', [ + 'entity' => null, + 'ajax' => false, + 'raw' => true, + 'data' => [ + 'fields' => [ + ], + 'submit' => [ + 'action' => $this->request->getParam('action') + ] + ] +]); +$formHTML = sprintf('
%s
', $form); +$bodyMessage = h($question ?? ''); +$bodyHTML = sprintf('%s%s', $formHTML, $bodyMessage); + +$defaultOptions = [ + 'size' => 'lg', + 'title' => isset($title) ? h($title) : __('Confirm'), + 'type' => 'confirm', + 'confirmButton' => [ + 'text' => !empty($actionName) ? h($actionName) : __('Confirm'), + 'variant' => 'primary', + ], +]; +$modalOptions = array_merge($defaultOptions, $modalOptions ?? []); +$modalOptions['bodyHtml'] = $bodyHTML; + +echo $this->Bootstrap->modal($modalOptions); +?>