comparison core/lib/Drupal/Core/Action/ActionInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Action;
4
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6 use Drupal\Core\Executable\ExecutableInterface;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10 * Provides an interface for an Action plugin.
11 *
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'
18 * annotation.
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.
25 *
26 * @see \Drupal\Core\Annotation\Action
27 * @see \Drupal\Core\Action\ActionManager
28 * @see \Drupal\Core\Action\ActionBase
29 * @see plugin_api
30 */
31 interface ActionInterface extends ExecutableInterface, PluginInspectionInterface {
32
33 /**
34 * Executes the plugin for an array of objects.
35 *
36 * @param array $objects
37 * An array of entities.
38 */
39 public function executeMultiple(array $objects);
40
41 /**
42 * Checks object access.
43 *
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.
51 *
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".
58 */
59 public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE);
60
61 }