Index Actions
Index actions are the buttons that appear next to each item in a CRUD index.
You can add and remove these from your CRUD config.
Actions are referred to by their unique name. Defaults include 'edit' and 'delete'.
Removing Actions
$this->removeIndexAction('delete');
Updating Actions
$this->updateIndexAction('edit', [
'title' => 'Change',
]);
You can pass a boolean as a third parameter to updateIndexAction which, if true, will use array_replace_recursive instead of array_replace.
$this->updateIndexAction('edit', [
'button' => [
'content' => 'fa fa-bicycle',
],
], true);
Adding Actions
$this->addIndexAction('edit', [
'component' => 'link-button',
'route' => '/%ID%/edit',
'title' => 'Edit',
'wrapperClass' => 'button',
'button' => [
'type' => 'fa',
'content' => 'fa fa-pencil-square-o',
],
'order' => 10,
];
Adding Multiple Actions
$this->addIndexAction([
'edit' => [
'component' => 'link-button',
'route' => '/%ID%/edit',
'title' => 'Edit',
'wrapperClass' => 'button',
'button' => [
'type' => 'fa',
'content' => 'fa fa-pencil-square-o',
],
'order' => 10,
],
'delete' => [
'component' => 'action-button',
'method' => 'delete',
'route' => '/%ID%',
'title' => 'Delete',
'wrapperClass' => 'button is-danger',
'confirm' => [
'title' => 'Sure?',
'text' => 'Are you sure you want to delete this item?',
'type' => 'warning',
],
'button' => [
'type' => 'fa',
'content' => 'fa fa-trash-o',
],
'order' => 20,
],
];