class Condition

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition
  2. 8.9.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition
  3. 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/Condition.php \Drupal\Core\Entity\Query\Sql\Condition
  4. 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php \Drupal\Core\Entity\Query\Sql\pgsql\Condition
  5. 8.9.x core/lib/Drupal/Core/Entity/Query/Null/Condition.php \Drupal\Core\Entity\Query\Null\Condition
  6. 8.9.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php \Drupal\Core\Entity\KeyValueStore\Query\Condition
Same name and namespace in other branches
  1. 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Condition.php \Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses\Condition
  2. 9 core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition
  3. 9 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition
  4. 9 core/lib/Drupal/Core/Entity/Query/Sql/Condition.php \Drupal\Core\Entity\Query\Sql\Condition
  5. 9 core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php \Drupal\Core\Entity\Query\Sql\pgsql\Condition
  6. 9 core/lib/Drupal/Core/Entity/Query/Null/Condition.php \Drupal\Core\Entity\Query\Null\Condition
  7. 9 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php \Drupal\Core\Entity\KeyValueStore\Query\Condition
  8. 9 core/lib/Drupal/Core/Condition/Annotation/Condition.php \Drupal\Core\Condition\Annotation\Condition
  9. 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Condition.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\Condition
  10. 10 core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition
  11. 10 core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition
  12. 10 core/lib/Drupal/Core/Entity/Query/Sql/Condition.php \Drupal\Core\Entity\Query\Sql\Condition
  13. 10 core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php \Drupal\Core\Entity\Query\Sql\pgsql\Condition
  14. 10 core/lib/Drupal/Core/Entity/Query/Null/Condition.php \Drupal\Core\Entity\Query\Null\Condition
  15. 10 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php \Drupal\Core\Entity\KeyValueStore\Query\Condition
  16. 10 core/lib/Drupal/Core/Condition/Attribute/Condition.php \Drupal\Core\Condition\Attribute\Condition
  17. 10 core/lib/Drupal/Core/Condition/Annotation/Condition.php \Drupal\Core\Condition\Annotation\Condition
  18. 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Condition.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\Condition
  19. 11.x core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition
  20. 11.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition
  21. 11.x core/lib/Drupal/Core/Entity/Query/Sql/Condition.php \Drupal\Core\Entity\Query\Sql\Condition
  22. 11.x core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php \Drupal\Core\Entity\Query\Sql\pgsql\Condition
  23. 11.x core/lib/Drupal/Core/Entity/Query/Null/Condition.php \Drupal\Core\Entity\Query\Null\Condition
  24. 11.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php \Drupal\Core\Entity\KeyValueStore\Query\Condition
  25. 11.x core/lib/Drupal/Core/Condition/Attribute/Condition.php \Drupal\Core\Condition\Attribute\Condition
  26. 11.x core/lib/Drupal/Core/Condition/Annotation/Condition.php \Drupal\Core\Condition\Annotation\Condition

Defines a condition plugin annotation object.

Condition plugins provide generalized conditions for use in other operations, such as conditional block placement.

Plugin Namespace: Plugin\Condition

For a working example, see \Drupal\user\Plugin\Condition\UserRole.

Hierarchy

Expanded class hierarchy of Condition

See also

\Drupal\Core\Condition\ConditionManager

\Drupal\Core\Condition\ConditionInterface

\Drupal\Core\Condition\ConditionPluginBase

Block API

Related topics

7 string references to 'Condition'
ConditionAggregate::compile in core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php
Compiles this conditional clause.
ConditionManager::getType in core/lib/Drupal/Core/Condition/ConditionManager.php
A string identifying the plugin type.
Connection::condition in core/lib/Drupal/Core/Database/Connection.php
Prepares and returns a CONDITION query object.
Connection::getDriverClass in core/lib/Drupal/Core/Database/Connection.php
Gets the driver-specific override class if any for the specified class.
core.data_types.schema.yml in core/config/schema/core.data_types.schema.yml
core/config/schema/core.data_types.schema.yml

... See full list

10 classes are annotated with Condition
BaloneySpam in core/modules/block/tests/modules/block_test/src/Plugin/Condition/BaloneySpam.php
Provides a 'baloney_spam' condition.
ConditionTestDualUser in core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php
Provides a condition that requires two users.
ConditionTestNoExistingType in core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestNoExistingType.php
Provides a condition that has a no existing context.
CurrentThemeCondition in core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php
Provides a 'Current Theme' condition.
Language in core/modules/language/src/Plugin/Condition/Language.php
Provides a 'Language' condition.

... See full list

File

core/lib/Drupal/Core/Condition/Annotation/Condition.php, line 26

Namespace

Drupal\Core\Condition\Annotation
View source
class Condition extends Plugin {
    
    /**
     * The condition plugin ID.
     *
     * @var string
     */
    public $id;
    
    /**
     * The human-readable name of the condition.
     *
     * @ingroup plugin_translatable
     *
     * @var \Drupal\Core\Annotation\Translation
     */
    public $label;
    
    /**
     * The name of the module providing the type.
     *
     * @var string
     */
    public $module;
    
    /**
     * An array of context definitions describing the context used by the plugin.
     *
     * The array is keyed by context names.
     *
     * @var \Drupal\Core\Annotation\ContextDefinition[]
     *
     * @deprecated Providing context definitions via the "context" key is
     *   deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use
     *   the "context_definitions" key instead.
     */
    public $context = [];
    
    /**
     * An array of context definitions describing the context used by the plugin.
     *
     * The array is keyed by context names.
     *
     * @var \Drupal\Core\Annotation\ContextDefinition[]
     */
    public $context_definitions = [];
    
    /**
     * The category under which the condition should listed in the UI.
     *
     * @var \Drupal\Core\Annotation\Translation
     *
     * @ingroup plugin_translatable
     */
    public $category;

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
Condition::$category public property The category under which the condition should listed in the UI.
Condition::$context Deprecated public property An array of context definitions describing the context used by the plugin.
Condition::$context_definitions public property An array of context definitions describing the context used by the plugin.
Condition::$id public property The condition plugin ID.
Condition::$label public property The human-readable name of the condition.
Condition::$module public property The name of the module providing the type.
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 5
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 2

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