Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Condition.php

class Condition

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition
  2. 11.1.x core/lib/Drupal/Core/Condition/Annotation/Condition.php \Drupal\Core\Condition\Annotation\Condition
  3. 11.1.x core/lib/Drupal/Core/Entity/Query/Null/Condition.php \Drupal\Core\Entity\Query\Null\Condition
  4. 11.1.x core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php \Drupal\Core\Entity\Query\Sql\pgsql\Condition
  5. 11.1.x core/lib/Drupal/Core/Entity/Query/Sql/Condition.php \Drupal\Core\Entity\Query\Sql\Condition
  6. 11.1.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php \Drupal\Core\Entity\KeyValueStore\Query\Condition
  7. 11.1.x core/lib/Drupal/Core/Database/Query/Condition.php \Drupal\Core\Database\Query\Condition

Defines a condition plugin attribute.

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

  • class \Drupal\Component\Plugin\Attribute\AttributeBase implements \Drupal\Component\Plugin\Attribute\AttributeInterface
    • class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
      • class \Drupal\Core\Condition\Attribute\Condition extends \Drupal\Component\Plugin\Attribute\Plugin

Expanded class hierarchy of Condition

See also

\Drupal\Core\Condition\ConditionManager

\Drupal\Core\Condition\ConditionInterface

\Drupal\Core\Condition\ConditionPluginBase

Block API

Related topics

Plugin API
Using the Plugin API
7 files declare their use of Condition
ConditionManager.php in core/lib/Drupal/Core/Condition/ConditionManager.php
CurrentThemeCondition.php in core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php
EntityBundle.php in core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php
Language.php in core/modules/language/src/Plugin/Condition/Language.php
RequestPath.php in core/modules/system/src/Plugin/Condition/RequestPath.php

... See full list

5 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.
core.data_types.schema.yml in core/config/schema/core.data_types.schema.yml
core/config/schema/core.data_types.schema.yml
QueryBase::conditionGroupFactory in core/lib/Drupal/Core/Entity/Query/QueryBase.php
Creates an object holding a group of conditions.
XmlFileLoader::parseConfigs in vendor/symfony/routing/Loader/XmlFileLoader.php
Parses the config elements (default, requirement, option).

File

core/lib/Drupal/Core/Condition/Attribute/Condition.php, line 27

Namespace

Drupal\Core\Condition\Attribute
View source
class Condition extends Plugin {
    
    /**
     * Constructs a Condition attribute.
     *
     * @param string $id
     *   The plugin ID.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $label
     *   (optional) The human-readable name of the condition.
     * @param string|null $module
     *   (optional) The name of the module providing the type.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $category
     *   (optional) The category under which the condition should be listed in the
     *   UI.
     * @param array $context_definitions
     *   (optional) An array of context definitions describing the context used by
     *   the plugin.
     * @param class-string|null $deriver
     *   (optional) The deriver class.
     */
    public function __construct(string $id, ?TranslatableMarkup $label = NULL, ?string $module = NULL, ?TranslatableMarkup $category = NULL, array $context_definitions = [], ?string $deriver = NULL) {
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::get public function Gets the value of an attribute. Overrides AttributeInterface::get 6
AttributeBase::getClass public function Gets the class of the attribute class. Overrides AttributeInterface::getClass 1
AttributeBase::getId public function Gets the unique ID for this attribute class. Overrides AttributeInterface::getId
AttributeBase::getProvider public function Gets the name of the provider of the attribute class. Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Sets the class of the attributed class. Overrides AttributeInterface::setClass 1
AttributeBase::setProvider public function Sets the name of the provider of the attribute class. Overrides AttributeInterface::setProvider
Condition::__construct public function Constructs a Condition attribute. Overrides Plugin::__construct
RSS feed
Powered by Drupal