You are here

function rules_action_data_calc_operator_options in Rules 7.2

Options list callback for the data calculation action.

Related topics

1 string reference to 'rules_action_data_calc_operator_options'
rules_data_action_info in modules/data.rules.inc
Implements hook_rules_action_info() on behalf of the pseudo data module.

File

modules/data.rules.inc, line 445
General data related rules integration.

Code

function rules_action_data_calc_operator_options(RulesPlugin $element, $param_name) {
  $options = array(
    '+' => '( + )',
    '-' => '( - )',
    '*' => '( * )',
    '/' => '( / )',
    'min' => 'min',
    'max' => 'max',
  );

  // Only show +/- in case a date has been selected.
  if (($info = $element
    ->getArgumentInfo('input_1')) && $info['type'] == 'date') {
    unset($options['*']);
    unset($options['/']);
    unset($options['min']);
    unset($options['max']);
  }
  return $options;
}