You are here

function commerce_condition_entity_exists_info_alter in Commerce Core 7

Info alteration callback for the entity query action.

File

./commerce.rules.inc, line 78
Rules integration for Drupal Commerce.

Code

function commerce_condition_entity_exists_info_alter(&$element_info, RulesAbstractPlugin $element) {
  $element->settings += array(
    'type' => NULL,
    'property' => NULL,
  );
  if ($element->settings['type']) {
    $element_info['parameter']['property']['options list'] = 'commerce_condition_entity_exists_property_options_list';
    if ($element->settings['property']) {
      $wrapper = entity_metadata_wrapper($element->settings['type']);
      if (isset($wrapper->{$element->settings['property']}) && ($property = $wrapper->{$element->settings['property']})) {
        $element_info['parameter']['value']['type'] = $property
          ->type();
        $element_info['parameter']['value']['options list'] = $property
          ->optionsList() ? 'commerce_condition_entity_exists_value_options_list' : FALSE;
      }
    }
  }
}