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