You are here

function civicrm_entity_query_info_alter in CiviCRM Entity 7

Same name and namespace in other branches
  1. 7.2 civicrm_entity.module \civicrm_entity_query_info_alter()

Info alteration callback for the entity query action. @todo this is copy of rules_action_entity_query_info_alter

Parameters

$element_info:

RulesAbstractPlugin $element:

File

./civicrm_entity.module, line 793
Implement CiviCRM entities as a Drupal Entity.

Code

function civicrm_entity_query_info_alter(&$element_info, RulesAbstractPlugin $element) {
  $element->settings += array(
    'type' => NULL,
    'property' => NULL,
  );
  if ($element->settings['type']) {
    $element_info['parameter']['property']['options list'] = 'rules_action_entity_query_property_options_list';
    if ($element->settings['property']) {
      $wrapper = rules_get_entity_metadata_wrapper_all_properties($element);
      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() ? 'rules_action_entity_query_value_options_list' : FALSE;
      }
    }
  }
  $element_info['provides']['entity_fetched']['type'] = 'list<' . $element->settings['type'] . '>';
}