You are here

interface ActionInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Action/ActionInterface.php \Drupal\Core\Action\ActionInterface

Provides an interface for an Action plugin.

@todo 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.

Hierarchy

Expanded class hierarchy of ActionInterface

All classes that implement ActionInterface

See also

\Drupal\Core\Annotation\Action

\Drupal\Core\Action\ActionManager

\Drupal\Core\Action\ActionBase

Plugin API

1 file declares its use of ActionInterface
ActionUnitTest.php in core/modules/system/src/Tests/Action/ActionUnitTest.php
Contains \Drupal\system\Tests\Action\ActionUnitTest.

File

core/lib/Drupal/Core/Action/ActionInterface.php, line 36
Contains \Drupal\Core\Action\ActionInterface.

Namespace

Drupal\Core\Action
View source
interface ActionInterface extends ExecutableInterface, PluginInspectionInterface {

  /**
   * Executes the plugin for an array of objects.
   *
   * @param array $objects
   *   An array of entities.
   */
  public function executeMultiple(array $objects);

  /**
   * Checks object access.
   *
   * @param mixed $object
   *   The object to execute the action on.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   (optional) The user for which to check access, or NULL to check access
   *   for the current user. Defaults to NULL.
   * @param bool $return_as_object
   *   (optional) Defaults to FALSE.
   *
   * @return bool|\Drupal\Core\Access\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".
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
ActionInterface::access public function Checks object access. 23
ActionInterface::executeMultiple public function Executes the plugin for an array of objects. 1
ExecutableInterface::execute public function Executes the plugin. 25
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 2
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2