Implements generic user action. Assigned to a model it can be invoked by a user. Model\UserAction class contains a
meta information about the action (arguments, permissions, appliesTo records, etc) that will help UI/API or add-ons to display
action trigger (button) correctly in an automated way.
UserAction must NOT rely on any specific UI implementation.
| Properties |
public
|
string
|
$appliesTo = self::APPLIES_TO_SINGLE_RECORD
by default action is for a single record
by default action is for a single record
|
#
|
public
|
string
|
$modifier
How this action interact with record
How this action interact with record
|
#
|
public
|
(Closure(object, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed): mixed)|string
|
$callback
code to execute. By default will call entity method with same name
code to execute. By default will call entity method with same name
|
#
|
public
|
(Closure(object, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed): mixed)|string
|
$preview
identical to callback, but would generate preview of action without permanent effect
identical to callback, but would generate preview of action without permanent effect
|
#
|
public
|
string|null
|
$caption
caption to put on the button
caption to put on the button
|
#
|
public
|
string|(Closure($this): string)|null
|
$description
a longer description of this action.
a longer description of this action.
|
#
|
public
|
bool|string|(Closure($this): string)
|
$confirmation = false
Will ask user to confirm.
Will ask user to confirm.
|
#
|
public
|
bool|(Closure(object): bool)
|
$enabled = true
setting this to false will disable action.
setting this to false will disable action.
|
#
|
public
|
bool
|
$system = false
system action will be hidden from UI, but can still be explicitly triggered
system action will be hidden from UI, but can still be explicitly triggered
|
#
|
public
|
array<string, array<string, mixed>|Model>
|
$args = []
Argument definition.
|
#
|
public
|
array<int, string>|bool
|
$fields = []
Specify which fields may be dirty when invoking action. APPLIES_TO_NO_RECORDS|APPLIES_TO_SINGLE_RECORD scopes for…
Specify which fields may be dirty when invoking action. APPLIES_TO_NO_RECORDS|APPLIES_TO_SINGLE_RECORD scopes for adding/modifying
|
#
|
public
|
bool
|
$atomic = true
Atomic action will automatically begin transaction before and commit it after completing.
Atomic action will automatically begin transaction before and commit it after completing.
|
#
|