interface ActionInterface implements ExecutableInterface, PluginInspectionInterface (View source)

Provides an interface for an Action plugin.

WARNING: The action API is going to receive some additions before release. The following additions are likely to happen: - The way configuration is handled and configuration forms are built is likely to change in order for the plugin to be of use for Rules. - Actions are going to become context-aware in https://www.drupal.org/node/2011038, what will deprecated the 'type' annotation. - Instead of action implementations saving entities, support for marking required context as to be saved by the execution manager will be added as part of https://www.drupal.org/node/2347017. - Actions will receive a data processing API that allows for token replacements to happen outside of the action plugin implementations, see https://www.drupal.org/node/2347023.

Methods

execute()

Executes the plugin.

string
getPluginId()

Gets the plugin_id of the plugin instance.

array
getPluginDefinition()

Gets the definition of the plugin implementation.

executeMultiple(array $objects)

Executes the plugin for an array of objects.

access(mixed $object, AccountInterface $account = NULL, bool $return_as_object = FALSE)

Checks object access.

Details

execute()

Executes the plugin.

string getPluginId()

Gets the plugin_id of the plugin instance.

Return Value

string

The plugin_id of the plugin instance.

array getPluginDefinition()

Gets the definition of the plugin implementation.

Return Value

array

The plugin definition, as returned by the discovery object used by the plugin manager.

executeMultiple(array $objects)

Executes the plugin for an array of objects.

Parameters

array $objects

An array of entities.

bool|AccessResultInterface access(mixed $object, AccountInterface $account = NULL, bool $return_as_object = FALSE)

Checks object access.

Parameters

mixed $object

The object to execute the action on.

AccountInterface $account

(optional) The user for which to check access, or NULL to check access for the current user. Defaults to NULL.

bool $return_as_object

(optional) Defaults to FALSE.

Return Value

bool|AccessResultInterface

The access result. Returns a boolean if $return_as_object is FALSE (this is the default) and otherwise an AccessResultInterface object. When a boolean is returned, the result of AccessInterface::isAllowed() is returned, i.e. TRUE means access is explicitly allowed, FALSE means access is either explicitly forbidden or "no opinion".