chg: [genericTemplates:toggle] Added support of confirm modal

develop-unstable
Sami Mokaddem 2023-02-13 15:31:00 +01:00
parent 5175564c47
commit c43772315a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 14 additions and 1 deletions

View File

@ -1 +1,14 @@
<?= $this->Form->postLink(__('Toggle'), ['action' => 'toggle', $entity->id, $fieldName], ['confirm' => __('Are you sure you want to toggle {0} of {1}?', $fieldName. $entity->id)]) ?>
<?php
$form = $this->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('<div class="d-none">%s</div>', $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);
?>