繁体   English   中英

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

[英]CakePHP 3.0 - Post Link - adding a class removes alert confirmation functionality

如何为该代码添加类?

$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)]
)

confirmclass应该在同一数组中

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

确认之前设置课程

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM