3 namespace Drupal\Core\Condition;
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;
13 * An interface for condition plugins.
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.
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.
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
45 interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
48 * Determines whether condition result will be negated.
51 * Whether the condition result will be negated.
53 public function isNegated();
56 * Evaluates the condition and returns TRUE or FALSE accordingly.
59 * TRUE if the condition has been met, FALSE otherwise.
61 public function evaluate();
64 * Provides a human readable summary of the condition's configuration.
66 public function summary();
69 * Sets the executable manager class.
71 * @param \Drupal\Core\Executable\ExecutableManagerInterface $executableManager
72 * The executable manager.
74 public function setExecutableManager(ExecutableManagerInterface $executableManager);