function ctools_condition_info_alter
Same name in other branches
- 4.0.x ctools.module \ctools_condition_info_alter()
Implements Hook Info alter.
Parameters
$definitions:
File
-
./
ctools.module, line 92
Code
function ctools_condition_info_alter(&$definitions) {
// Replace all generic entity bundle conditions classes if they are unaltered,
// these exist in Drupal 9.3+.
foreach ($definitions as $id => $definition) {
if (strpos($id, 'entity_bundle:') === 0 && ($definition['class'] == CoreEntityBundle::class || $definition['class'] == 'Drupal\\ctools\\Plugin\\Condition\\EntityBundleConstraint')) {
$definitions[$id]['class'] = EntityBundle::class;
}
}
if (\version_compare(\Drupal::VERSION, '10.0', '<')) {
// Drupal 9.x only: override core node_type with ctools constraints.
$definitions['node_type'] = $definitions['entity_bundle:node'];
$definitions['node_type']['id'] = 'node_type';
$definitions['node_type']['class'] = NodeType::class;
}
}