interface ConditionInterface

Same name in this branch
  1. 9 core/lib/Drupal/Core/Database/Query/ConditionInterface.php \Drupal\Core\Database\Query\ConditionInterface
  2. 9 core/lib/Drupal/Core/Entity/Query/ConditionInterface.php \Drupal\Core\Entity\Query\ConditionInterface
Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/ConditionInterface.php \Drupal\Core\Database\Query\ConditionInterface
  2. 8.9.x core/lib/Drupal/Core/Entity/Query/ConditionInterface.php \Drupal\Core\Entity\Query\ConditionInterface
  3. 8.9.x core/lib/Drupal/Core/Condition/ConditionInterface.php \Drupal\Core\Condition\ConditionInterface
  4. 10 core/lib/Drupal/Core/Database/Query/ConditionInterface.php \Drupal\Core\Database\Query\ConditionInterface
  5. 10 core/lib/Drupal/Core/Entity/Query/ConditionInterface.php \Drupal\Core\Entity\Query\ConditionInterface
  6. 10 core/lib/Drupal/Core/Condition/ConditionInterface.php \Drupal\Core\Condition\ConditionInterface
  7. 11.x core/lib/Drupal/Core/Database/Query/ConditionInterface.php \Drupal\Core\Database\Query\ConditionInterface
  8. 11.x core/lib/Drupal/Core/Entity/Query/ConditionInterface.php \Drupal\Core\Entity\Query\ConditionInterface
  9. 11.x core/lib/Drupal/Core/Condition/ConditionInterface.php \Drupal\Core\Condition\ConditionInterface

An interface for condition plugins.

Condition plugins are context-aware and configurable. They support the following keys in their plugin definitions:

  • context: An array of context definitions, keyed by context name. Each context definition is a typed data definition describing the context. Check the typed data definition docs for details.
  • configuration: An array of configuration option definitions, keyed by option name. Each option definition is a typed data definition describing the configuration option. Check the typed data definition docs for details.

@todo Replace the dependency on \Drupal\Core\Form\FormInterface with a new interface from @todo WARNING: The condition 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.
  • Conditions will receive a data processing API that allows for token replacements to happen outside of the plugin implementations, see
  • Conditions will have to implement access control for checking who is allowed to configure or perform the action at


Expanded class hierarchy of ConditionInterface

All classes that implement ConditionInterface

See also






Related topics


core/lib/Drupal/Core/Condition/ConditionInterface.php, line 46


View source
interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurableInterface, DependentPluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
     * Determines whether condition result will be negated.
     * @return bool
     *   Whether the condition result will be negated.
    public function isNegated();
     * Evaluates the condition and returns TRUE or FALSE accordingly.
     * @return bool
     *   TRUE if the condition has been met, FALSE otherwise.
    public function evaluate();
     * Provides a human readable summary of the condition's configuration.
    public function summary();
     * Sets the executable manager class.
     * @param \Drupal\Core\Executable\ExecutableManagerInterface $executableManager
     *   The executable manager.
    public function setExecutableManager(ExecutableManagerInterface $executableManager);



Title Sort descending Modifiers Object type Summary Overrides
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ConditionInterface::evaluate public function Evaluates the condition and returns TRUE or FALSE accordingly. 11
ConditionInterface::isNegated public function Determines whether condition result will be negated. 1
ConditionInterface::setExecutableManager public function Sets the executable manager class. 1
ConditionInterface::summary public function Provides a human readable summary of the condition's configuration. 11
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 14
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 15
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 15
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 20
ExecutableInterface::execute public function Executes the plugin. 21
PluginFormInterface::buildConfigurationForm public function Form constructor. 33
PluginFormInterface::submitConfigurationForm public function Form submission handler. 31
PluginFormInterface::validateConfigurationForm public function Form validation handler. 17
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 6
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.