You are here

function rules_condition_data_is_info_alter in Rules 7.2

Info alteration callback for the data_is condition.

If we check the bundle property of a variable, add an assertion so that later evaluated elements can make use of this information.

Related topics

File

modules/data.eval.inc, line 380
Contains rules integration for the data module needed during evaluation.

Code

function rules_condition_data_is_info_alter(&$element_info, RulesAbstractPlugin $element) {
  $element->settings += array(
    'data:select' => NULL,
    'op' => '==',
  );
  if ($wrapper = $element
    ->applyDataSelector($element->settings['data:select'])) {
    $info = $wrapper
      ->info();
    $element_info['parameter']['value']['type'] = $element->settings['op'] == 'IN' ? 'list<' . $wrapper
      ->type() . '>' : $wrapper
      ->type();
    $element_info['parameter']['value']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
  }
}