3 namespace Drupal\Core\Action;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6 use Drupal\Core\Executable\ExecutableInterface;
7 use Drupal\Core\Session\AccountInterface;
10 * Provides an interface for an Action plugin.
12 * @todo WARNING: The action API is going to receive some additions before
13 * release. The following additions are likely to happen:
14 * - The way configuration is handled and configuration forms are built is
15 * likely to change in order for the plugin to be of use for Rules.
16 * - Actions are going to become context-aware in
17 * https://www.drupal.org/node/2011038, what will deprecated the 'type'
19 * - Instead of action implementations saving entities, support for marking
20 * required context as to be saved by the execution manager will be added as
21 * part of https://www.drupal.org/node/2347017.
22 * - Actions will receive a data processing API that allows for token
23 * replacements to happen outside of the action plugin implementations,
24 * see https://www.drupal.org/node/2347023.
26 * @see \Drupal\Core\Annotation\Action
27 * @see \Drupal\Core\Action\ActionManager
28 * @see \Drupal\Core\Action\ActionBase
31 interface ActionInterface extends ExecutableInterface, PluginInspectionInterface {
34 * Executes the plugin for an array of objects.
36 * @param array $objects
37 * An array of entities.
39 public function executeMultiple(array $objects);
42 * Checks object access.
44 * @param mixed $object
45 * The object to execute the action on.
46 * @param \Drupal\Core\Session\AccountInterface $account
47 * (optional) The user for which to check access, or NULL to check access
48 * for the current user. Defaults to NULL.
49 * @param bool $return_as_object
50 * (optional) Defaults to FALSE.
52 * @return bool|\Drupal\Core\Access\AccessResultInterface
53 * The access result. Returns a boolean if $return_as_object is FALSE (this
54 * is the default) and otherwise an AccessResultInterface object.
55 * When a boolean is returned, the result of AccessInterface::isAllowed() is
56 * returned, i.e. TRUE means access is explicitly allowed, FALSE means
57 * access is either explicitly forbidden or "no opinion".
59 public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE);