function ctools_condition_info_alter

Same name in other branches
  1. 8.x-3.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) {
    // If the node_type's class is unaltered, migrate to entity bundle.
    if (isset($definitions['node_type']) && $definitions['node_type']['class'] == 'Drupal\\node\\Plugin\\Condition\\NodeType') {
        @trigger_error('\\Drupal\\node\\Plugin\\Condition\\NodeType is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \\Drupal\\Core\\Entity\\Plugin\\Condition\\EntityBundle instead. See https://www.drupal.org/node/2983299', E_USER_DEPRECATED);
        $definitions['node_type']['class'] = EntityBundleConstraint::class;
    }
    // Replace all generic entity bundle conditions classes if they are unaltered,
    // these exist in Drupal 9.3+.
    foreach ($definitions as $id => $definition) {
        
        //@phpstan-ignore-next-line
        if (strpos($id, 'entity_bundle:') === 0 && $definition['class'] == EntityBundle::class) {
            @trigger_error('\\Drupal\\ctools\\Plugin\\Condition\\EntityBundle is deprecated in ctools:8.x-3.10 and is removed from ctools:4.1.0. Use \\Drupal\\Core\\Entity\\Plugin\\Condition\\EntityBundle instead. See https://www.drupal.org/node/2983299', E_USER_DEPRECATED);
            $definitions[$id]['class'] = EntityBundleConstraint::class;
        }
        if (strpos($id, 'entity_bundle:') === 0 && $definition['class'] == CoreEntityBundle::class) {
            $definitions[$id]['class'] = EntityBundleConstraint::class;
        }
    }
}