addAction()
addAction(string $id, string $label, string $columnLabel, callable $callback, boolean $onList = true, boolean $onCard = true, string $faIcon = '', string $btnClass = '', string $position = '', string $fieldname = '', boolean $enabled = true, boolean $visible = true, $data = array()) : \Alddesign\Crudkit\Classes\PageDescriptor
Add a button with a custom action to this page.
Be creative, but take care. Your can write you own php code and use all of crudkits api to manipulate data, etc... (see apidoc-dev):
$callback = function($record, $pageDescriptor, $action) { mail('ceo@mydomain.com', 'Book info', 'Check out our new book: '. $record["name"]); };
$pageDescriptor->addAction('mail', 'Send book-info mail', 'Mail', $callback, true, true, envelope, 'info');
//Next thing: drop table studends;
Parameters
| string |
$id |
a identifier for this action (unique per page) |
| string |
$label |
Label of the button |
| string |
$columnLabel |
Label of the column in list view |
| callable |
$callback |
Callback function to execute when pressing the button. This callback has $record, $pageDescriptor, $action(this is what you definde here) as parameters. |
| boolean |
$onList |
(optional) Show on list page |
| boolean |
$onCard |
(optional) Show on card page |
| string |
$faIcon |
(optional) Icon for the Button. (Font Awesome icon name) |
| string |
$btnClass |
(optional) ''|'default'|'primary'|'info'|'success'|'danger'|'warning'. (Admin LTE Button class) |
| string |
$position |
(optional) 'top'|'bottom'|'both'|'before-field'|'after-field'|'to-field'. Position on card pages. |
| string |
$fieldname |
(optional) The reference fieldname for $postion ('before-field'|'after-field'|'to-field') |
| boolean |
$enabled |
(optional) If the button is enabled |
| boolean |
$visible |
(optional) If the button is visible |
|
$data |
|
Returns
\Alddesign\Crudkit\Classes\PageDescriptor