function rules_action_data_calc_info_alter
Info alter callback for the data_calc action.
Related topics
File
-
modules/
data.eval.inc, line 104
Code
function rules_action_data_calc_info_alter(&$element_info, RulesPlugin $element) {
if ($info = $element->getArgumentInfo('input_1')) {
// Only allow durations as offset for date values.
if ($info['type'] == 'date') {
$element_info['parameter']['input_2']['type'] = 'duration';
}
// Specify the data type of the result.
$element_info['provides']['result']['type'] = $info['type'];
if ($info['type'] == 'integer' && ($info2 = $element->getArgumentInfo('input_2')) && $info2['type'] == 'decimal') {
$element_info['provides']['result']['type'] = 'decimal';
}
elseif (isset($element->settings['op']) && $element->settings['op'] == '/') {
$element_info['provides']['result']['type'] = 'decimal';
}
}
}