Action
in package
Defines a custom action on a page.
Actions are buttons on a page which execute user definded functions.
Table of Contents
- BTNCLASSES = ['default', 'primary', 'info', 'success', 'danger', 'warning', 'accent']
- POSITIONS = ['top', 'bottom', 'both', 'before-field', 'after-field', 'to-field']
- $btnClass : string
- $callback : callable
- $data : array<string|int, mixed>
- $enabled : string
- $faIcon : string
- $fieldname : string
- $label : string
- $onCard : bool
- $onList : bool
- $onUpdate : bool
- $position : string
- $value : string
- $visible : string
- __construct() : Action
- Constructor. Params are basically the properies of this class.
- setBtnClass() : Action
- Defines the button appearance. Admin LTE button type. '','default','primary','info','success','danger','warning','accent'. '' = no button, just a link.
- setCallback() : Action
- The callback function for the action
- setData() : Action
- Additional data which can be set when creatig the action. (Can be accessed in the callback function)
- setEnabled() : Action
- Enableds/disables the action
- setFaIcon() : Action
- The icon for the button (font awesome icon name)
- setFieldname() : Action
- The reference fieldname for setPosition() $position
- setLabel() : Action
- The text of the label for the action
- setOnCard() : Action
- Show/hide on card pages.
- setOnList() : Action
- Show/hide on list pages
- setOnUpdate() : Action
- Show/hides on update pages.
- setPosition() : Action
- 'top','bottom','both', 'before-field', 'after-field', 'to-field'. Use togehter with setFieldname() $fieldname.
- setValue() : Action
- The text for the action itselft
- setVisible() : Action
- Show/hide on all pages
Constants
BTNCLASSES
public
mixed
BTNCLASSES
= ['default', 'primary', 'info', 'success', 'danger', 'warning', 'accent']
Tags
POSITIONS
public
mixed
POSITIONS
= ['top', 'bottom', 'both', 'before-field', 'after-field', 'to-field']
Tags
Properties
$btnClass
public
string
$btnClass
= 'default'
Defines the button appearance. Admin LTE button type. '','default','primary','info','success','danger','warning','accent'. '' = no button, just a link.
$callback
public
callable
$callback
= null
The function to execute
$data
public
array<string|int, mixed>
$data
= []
Additional data which can be set when creatig the action. (Can be accessed in the callback function)
$enabled
public
string
$enabled
= true
Enableds/disables the action
$faIcon
public
string
$faIcon
= ''
The icon for the button (font awesome icon name)
$fieldname
public
string
$fieldname
= ''
The reference fieldname for setPosition() $position
$label
public
string
$label
= ''
The text of the label for the action
$onCard
public
bool
$onCard
= true
Show/hide on card pages
$onList
public
bool
$onList
= true
Show/hide on list pages
$onUpdate
public
bool
$onUpdate
= true
Show/hide on update pages
$position
public
string
$position
= ''
'top','bottom','both', 'before-field', 'after-field', 'to-field'. Use togehter with setFieldname() $fieldname.
$value
public
string
$value
= ''
The text for the action button itselft
$visible
public
string
$visible
= true
Show/hide on all pages
Methods
__construct()
Constructor. Params are basically the properies of this class.
public
__construct(string $value, string $label[, callable $callback = null ][, string $position = 'both' ][, string $fieldname = '' ]) : Action
Parameters
- $value : string
-
The text for the action button itselft
- $label : string
-
The text of the label for the action
- $callback : callable = null
-
The function to execute
- $position : string = 'both'
-
'top','bottom','both', 'before-field', 'after-field', 'to-field'
- $fieldname : string = ''
-
reference fieldname for $position
Return values
Action —setBtnClass()
Defines the button appearance. Admin LTE button type. '','default','primary','info','success','danger','warning','accent'. '' = no button, just a link.
public
setBtnClass([string $btnClass = 'default' ]) : Action
Parameters
- $btnClass : string = 'default'
Return values
Action —setCallback()
The callback function for the action
public
setCallback(callable $callback) : Action
Parameters
- $callback : callable
Return values
Action —setData()
Additional data which can be set when creatig the action. (Can be accessed in the callback function)
public
setData(mixed $data) : Action
Parameters
- $data : mixed
Return values
Action —setEnabled()
Enableds/disables the action
public
setEnabled([bool $enabled = true ]) : Action
Parameters
- $enabled : bool = true
Return values
Action —setFaIcon()
The icon for the button (font awesome icon name)
public
setFaIcon(string $faIcon) : Action
Parameters
- $faIcon : string
Return values
Action —setFieldname()
The reference fieldname for setPosition() $position
public
setFieldname(string $fieldname) : Action
Parameters
- $fieldname : string
Return values
Action —setLabel()
The text of the label for the action
public
setLabel(string $label) : Action
Parameters
- $label : string
Return values
Action —setOnCard()
Show/hide on card pages.
public
setOnCard([bool $onCard = true ]) : Action
Parameters
- $onCard : bool = true
Return values
Action —setOnList()
Show/hide on list pages
public
setOnList([bool $onList = true ]) : Action
Parameters
- $onList : bool = true
Return values
Action —setOnUpdate()
Show/hides on update pages.
public
setOnUpdate([bool $onUpdate = true ]) : Action
Parameters
- $onUpdate : bool = true
Return values
Action —setPosition()
'top','bottom','both', 'before-field', 'after-field', 'to-field'. Use togehter with setFieldname() $fieldname.
public
setPosition(string $position) : Action
Parameters
- $position : string
Return values
Action —setValue()
The text for the action itselft
public
setValue(string $value) : Action
Parameters
- $value : string
Return values
Action —setVisible()
Show/hide on all pages
public
setVisible([bool $visible = true ]) : Action
Parameters
- $visible : bool = true