function rules_action_entity_fetch_info_alter in Rules 7.2
Info alteration callback for the entity fetch action.
Related topics
File
- modules/
entity.eval.inc, line 34 - Contains rules integration for entities needed during evaluation.
Code
function rules_action_entity_fetch_info_alter(&$element_info, RulesAbstractPlugin $element) {
$element->settings += array(
'type' => NULL,
);
$info = entity_get_info($element->settings['type']);
// Fix the type of the identifier.
$element_info['parameter']['id']['type'] = isset($info['entity keys']['name']) ? 'text' : 'integer';
// Add an optional revision parameter, if supported.
if (!empty($info['entity keys']['revision'])) {
$element_info['parameter']['revision_id'] = array(
'type' => 'integer',
'label' => t('Revision identifier'),
'optional' => TRUE,
);
}
$element_info['provides']['entity_fetched']['type'] = $element->settings['type'];
}