function hook_condition_info_alter

Same name and namespace in other branches
  1. 9 core/core.api.php \hook_condition_info_alter()
  2. 10 core/core.api.php \hook_condition_info_alter()

Alter the information provided in \Drupal\Core\Condition\ConditionManager::getDefinitions().

Parameters

array $definitions: The array of condition definitions.

Related topics

1 invocation of hook_condition_info_alter()
ConditionManager::__construct in core/lib/Drupal/Core/Condition/ConditionManager.php
Constructs a ConditionManager object.

File

core/core.api.php, line 1996

Code

function hook_condition_info_alter(array &$definitions) {
    // Add custom or modify existing condition definitions.
    if (isset($definitions['node_type']) && $definitions['node_type']['class'] == 'Drupal\\node\\Plugin\\Condition\\NodeType') {
        // If the node_type's class is unaltered, use a custom implementation.
        $definitions['node_type']['class'] = 'Drupal\\my_module\\Plugin\\Condition\\NodeType';
    }
}

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