From 1e2ebc81401b51c4f54cf5393c57c95e5185dde9 Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 4 Mar 2022 23:33:28 +0530 Subject: [PATCH] Fix delete link for related records. Closes #297 --- templates/element/view/related/has_many.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/element/view/related/has_many.php b/templates/element/view/related/has_many.php index 2507695..3551650 100644 --- a/templates/element/view/related/has_many.php +++ b/templates/element/view/related/has_many.php @@ -55,7 +55,15 @@ Html->link(__d('crud', 'View'), ['plugin' => $details['plugin'], 'controller' => $details['controller'], 'action' => 'view', ${$otherSingularVar}[$details['primaryKey']]], ['class' => 'btn btn-secondary']); ?> Html->link(__d('crud', 'Edit'), ['plugin' => $details['plugin'], 'controller' => $details['controller'], 'action' => 'edit', ${$otherSingularVar}[$details['primaryKey']]], ['class' => 'btn btn-secondary']); ?> - Html->link(__d('crud', 'Delete'), ['plugin' => $details['plugin'], 'controller' => $details['controller'], 'action' => 'delete', ${$otherSingularVar}[$details['primaryKey']]], ['class' => 'btn btn-secondary']); ?> + Form->postLink( + __d('crud', 'Delete'), + ['plugin' => $details['plugin'], 'controller' => $details['controller'], 'action' => 'delete', ${$otherSingularVar}[$details['primaryKey']]], + [ + 'class' => 'btn btn-danger btn-delete', + 'confirm' => __d('crud', 'Are you sure you want to delete this record?'), + 'name' => '_delete', + ] + ); ?>