function rules_action_entity_query_info_alter in Rules 7.2
Info alteration callback for the entity query action.
Related topics
File
- modules/
entity.eval.inc, line 63 - Contains rules integration for entities needed during evaluation.
Code
function rules_action_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']})) {
$property_type = $property
->type();
// If the cardinality of the property > 1, i.e. of type 'list<{type}>',
// we will also accept a parameter of type {type}.
if (substr($property_type, 0, strlen('list<')) === 'list<' && substr($property_type, -strlen('>')) === '>') {
$property_type = array(
$property_type,
substr($property_type, strlen('list<'), strlen($property_type) - strlen('list<>')),
);
}
$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'] . '>';
}