CakePHP 3.0 - 发布链接 - 添加类会删除警报确认功能

时间:2017-03-16 11:50:00

标签: javascript php cakephp cakephp-3.0

如何在此代码中添加类?

$this->Form->postLink(
    __('Delete'),
    ['action' => 'delete', $user->id],
    ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]
)

当我添加一个类时,"确认功能"消失。

$this->Form->postLink(
    __('Delete'),
    ['action' => 'delete', $user->id],
    ['class' => 'btn btn-danger'],
    ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]
)

2 个答案:

答案 0 :(得分:1)

class$this->Form->postLink( __('Delete'), ['action' => 'delete', $user->id], ['confirm' => __('Are you sure you want to delete # {0}?', $user->id),'class'=>'btn btn-danger'] ) 应位于同一个数组

{{1}}

答案 1 :(得分:0)

确认前设置课程

['class' => 'btn btn-danger','confirm' => __('Are you sure you want to delete # {0}?', $user->id)]