RowAction
in package
Action over one row (buttons in the last column). Two modes:
- link to a presenter action:
->setLink(':Admin:System:Page:edit', ['id' => 'id'])(URL parameter => entity property path), - component signal:
->setSignal('delete')callshandle<Signal>(int $id)on the grid (the built-indeletedeletes through the manager).
Plain configuration object: RowAction::create('edit')->setLabel(…)->….
Table of Contents
Constants
- TYPE_LINK : mixed = 'link'
- TYPE_SIGNAL : mixed = 'signal'
Properties
- $confirm : string|null
- $confirmTitle : string|null
- $confirmYes : string|null
- $destination : string
- $icon : string|null
- $label : string
- $name : string
- $params : array<string, string>
- $post : bool
- $signal : string|null
- $target : string|null
- $type : string
- $variant : string
- $visibleInPickerMode : bool
- $visibleWhen : callable(object): bool|null
Methods
- __construct() : mixed
- create() : static
- getConfirm() : string|null
- getConfirmTitle() : string|null
- getConfirmYes() : string|null
- getDestination() : string
- getIcon() : string|null
- getLabel() : string
- getName() : string
- getParams() : array<string, string>
- getSignal() : string|null
- getTarget() : string|null
- getType() : string
- getVariant() : string
- isPost() : bool
- isVisibleFor() : bool
- Whether the action is rendered for this row; always `true` without a condition.
- isVisibleInPickerMode() : bool
- setConfirm() : static
- Text of the confirmation dialog (JS confirm); null means no confirmation.
- setConfirmTexts() : static
- Custom title and "yes" button of the confirmation modal: the default grid texts are for deleting, so for another action the button would lie. `null` means the default grid text.
- setIcon() : static
- Key of the icon in the actions template (edit, cross, eye, …), see _actions.latte.
- setLabel() : static
- setLink() : static
- Link to a presenter action.
- setPost() : static
- The action is sent as POST (button instead of link), for writing signals with `#[Requires(methods: 'POST')]`: a GET link could be triggered by a robot or prefetch.
- setSignal() : static
- Grid signal `handle<Signal>(int $id)`, e.g. `delete`. Sent by POST by default.
- setTarget() : static
- setVariant() : static
- Button color role (`success`, `danger`, `secondary`, …) → `.btn--<variant>`.
- setVisibleWhen() : static
- Per-row visibility condition: `fn(object $entity): bool`. Without it the action is always visible.
- showInPickerMode() : static
Constants
TYPE_LINK
public
mixed
TYPE_LINK
= 'link'
TYPE_SIGNAL
public
mixed
TYPE_SIGNAL
= 'signal'
Properties
$confirm
protected
string|null
$confirm
= null
$confirmTitle
protected
string|null
$confirmTitle
= null
$confirmYes
protected
string|null
$confirmYes
= null
$destination
protected
string
$destination
= 'this'
$icon
protected
string|null
$icon
= null
$label
protected
string
$label
= ''
$name read-only
protected
string
$name
$params
protected
array<string, string>
$params
= []
URL parameter => property path
$post
protected
bool
$post
= false
$signal
protected
string|null
$signal
= null
$target
protected
string|null
$target
= null
$type
protected
string
$type
= self::TYPE_LINK
$variant
protected
string
$variant
= 'secondary'
$visibleInPickerMode
protected
bool
$visibleInPickerMode
= false
$visibleWhen
protected
callable(object): bool|null
$visibleWhen
= null
per-row visibility condition, see setVisibleWhen()
Methods
__construct()
public
final __construct(string $name) : mixed
Parameters
- $name : string
create()
public
static create(string $name) : static
Parameters
- $name : string
Return values
staticgetConfirm()
public
getConfirm() : string|null
Return values
string|nullgetConfirmTitle()
public
getConfirmTitle() : string|null
Return values
string|nullgetConfirmYes()
public
getConfirmYes() : string|null
Return values
string|nullgetDestination()
public
getDestination() : string
Return values
stringgetIcon()
public
getIcon() : string|null
Return values
string|nullgetLabel()
public
getLabel() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetParams()
public
getParams() : array<string, string>
Return values
array<string, string>getSignal()
public
getSignal() : string|null
Return values
string|nullgetTarget()
public
getTarget() : string|null
Return values
string|nullgetType()
public
getType() : string
Return values
stringgetVariant()
public
getVariant() : string
Return values
stringisPost()
public
isPost() : bool
Return values
boolisVisibleFor()
Whether the action is rendered for this row; always `true` without a condition.
public
isVisibleFor(object $entity) : bool
Parameters
- $entity : object
Return values
boolisVisibleInPickerMode()
public
isVisibleInPickerMode() : bool
Return values
boolsetConfirm()
Text of the confirmation dialog (JS confirm); null means no confirmation.
public
setConfirm(string|null $confirm) : static
Parameters
- $confirm : string|null
Return values
staticsetConfirmTexts()
Custom title and "yes" button of the confirmation modal: the default grid texts are for deleting, so for another action the button would lie. `null` means the default grid text.
public
setConfirmTexts(string|null $title, string|null $yes) : static
Parameters
- $title : string|null
- $yes : string|null
Return values
staticsetIcon()
Key of the icon in the actions template (edit, cross, eye, …), see _actions.latte.
public
setIcon(string|null $icon) : static
Parameters
- $icon : string|null
Return values
staticsetLabel()
public
setLabel(string $label) : static
Parameters
- $label : string
Return values
staticsetLink()
Link to a presenter action.
public
setLink(string $destination[, array<string, string> $params = [] ]) : static
Parameters
- $destination : string
- $params : array<string, string> = []
-
URL parameter => entity property path
Return values
staticsetPost()
The action is sent as POST (button instead of link), for writing signals with `#[Requires(methods: 'POST')]`: a GET link could be triggered by a robot or prefetch.
public
setPost([bool $post = true ]) : static
Parameters
- $post : bool = true
Return values
staticsetSignal()
Grid signal `handle<Signal>(int $id)`, e.g. `delete`. Sent by POST by default.
public
setSignal(string $signal) : static
Parameters
- $signal : string
Return values
staticsetTarget()
public
setTarget(string|null $target) : static
Parameters
- $target : string|null
Return values
staticsetVariant()
Button color role (`success`, `danger`, `secondary`, …) → `.btn--<variant>`.
public
setVariant(string $variant) : static
Parameters
- $variant : string
Return values
staticsetVisibleWhen()
Per-row visibility condition: `fn(object $entity): bool`. Without it the action is always visible.
public
setVisibleWhen(callable(object): bool $condition) : static
Needed when the decision depends on the row entity, e.g. deleting a job must disappear for closed
rows. setAddLink()/addRowAction() are configured for the whole grid, so "not adding the action
at all" does not work where open and closed rows sit side by side.
IMPORTANT: this mirrors the server guard, it does not replace it. The delete! signal calls the
manager, which verifies the state itself
(WorkListManager::beforeDelete()); hiding the button
alone is no protection.
Parameters
- $condition : callable(object): bool
Return values
staticshowInPickerMode()
public
showInPickerMode() : static