comparison core/lib/Drupal/Core/Condition/ConditionInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children af1871eacc83
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Condition;
4
5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
7 use Drupal\Core\Cache\CacheableDependencyInterface;
8 use Drupal\Core\Executable\ExecutableInterface;
9 use Drupal\Core\Executable\ExecutableManagerInterface;
10 use Drupal\Core\Plugin\PluginFormInterface;
11
12 /**
13 * An interface for condition plugins.
14 *
15 * Condition plugins are context-aware and configurable. They support the
16 * following keys in their plugin definitions:
17 * - context: An array of context definitions, keyed by context name. Each
18 * context definition is a typed data definition describing the context. Check
19 * the typed data definition docs for details.
20 * - configuration: An array of configuration option definitions, keyed by
21 * option name. Each option definition is a typed data definition describing
22 * the configuration option. Check the typed data definition docs for details.
23 *
24 * @todo Replace the dependency on \Drupal\Core\Form\FormInterface with a new
25 * interface from https://www.drupal.org/node/2006248.
26 * @todo WARNING: The condition API is going to receive some additions before release.
27 * The following additions are likely to happen:
28 * - The way configuration is handled and configuration forms are built is
29 * likely to change in order for the plugin to be of use for Rules.
30 * - Conditions will receive a data processing API that allows for token
31 * replacements to happen outside of the plugin implementations,
32 * see https://www.drupal.org/node/2347023.
33 * - Conditions will have to implement access control for checking who is
34 * allowed to configure or perform the action at
35 * https://www.drupal.org/node/2172017.
36 *
37 * @see \Drupal\Core\TypedData\TypedDataManager::create()
38 * @see \Drupal\Core\Executable\ExecutableInterface
39 * @see \Drupal\Core\Condition\ConditionManager
40 * @see \Drupal\Core\Condition\Annotation\Condition
41 * @see \Drupal\Core\Condition\ConditionPluginBase
42 *
43 * @ingroup plugin_api
44 */
45 interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
46
47 /**
48 * Determines whether condition result will be negated.
49 *
50 * @return bool
51 * Whether the condition result will be negated.
52 */
53 public function isNegated();
54
55 /**
56 * Evaluates the condition and returns TRUE or FALSE accordingly.
57 *
58 * @return bool
59 * TRUE if the condition has been met, FALSE otherwise.
60 */
61 public function evaluate();
62
63 /**
64 * Provides a human readable summary of the condition's configuration.
65 */
66 public function summary();
67
68 /**
69 * Sets the executable manager class.
70 *
71 * @param \Drupal\Core\Executable\ExecutableManagerInterface $executableManager
72 * The executable manager.
73 */
74 public function setExecutableManager(ExecutableManagerInterface $executableManager);
75
76 }