我正在为Prestashop编写一个覆盖AdminProductsController的模块,并在BackOffice的Products视图中的批量操作菜单中添加了两个操作。这是我在覆盖类
的构造中添加批量操作的代码public function __construct() {
parent::__construct();
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}
结果是这个
我想在删除所选和导出所选之间添加一个分隔符。我的意思是,在我新添加的条目之前添加之前。我怎样才能做到这一点?
答案 0 :(得分:2)
在添加操作之前添加分隔符。
public function __construct() {
parent::__construct();
/*
* $this->bulk_actions key can be anything except 'divider' as it already
* gets added for 'Enable/disabled selection'
* (and other already defined actions of course)
*/
$this->bulk_actions['my_actions_divider'] = array(
'text' => 'divider'
);
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}