abstract class Actions (View source)

The list of Actions.

Actions are a mechanism for performing tasks on one or more models – for example, deleting comments, or locking a post. Each item's context menu is really just this list of Actions, filtered so that only the relevant ones are displayed.

Use this extender to register a Waterhole\Actions\Action class. Plain components such as MenuDividers can also be added.

Traits

Methods

static void
add($content = null, int $position = 0, string|null $key = null)

Add an item to the list.

static void
replace(string $key, $content)

Replace an existing item in the list.

static void
remove(string $key)

Remove an item from the list.

static array|null
get(string $key)

Get an item in the list.

static array
build()

Get the resulting list in order.

static array
for($models, User $user = null)

Get a list of action instances that can be applied to the given model(s).

Details

static void add($content = null, int $position = 0, string|null $key = null)

Add an item to the list.

Parameters

$content
int $position
string|null $key

Return Value

void

static void replace(string $key, $content)

Replace an existing item in the list.

Parameters

string $key
$content

Return Value

void

static void remove(string $key)

Remove an item from the list.

Parameters

string $key

Return Value

void

static array|null get(string $key)

Get an item in the list.

Parameters

string $key

Return Value

array|null

static array build()

Get the resulting list in order.

Return Value

array

static array for($models, User $user = null)

Get a list of action instances that can be applied to the given model(s).

Parameters

$models
User $user

Return Value

array