You are here

function rb_numbers_rules_action_info in Rules Bonus Pack 6

Implementation of hook_rules_action_info().

File

./rb_numbers.module, line 12
Functions for extending number management with Rules.

Code

function rb_numbers_rules_action_info() {

  // Add all actions that depend on required modules only.
  $actions = array(
    'rb_numbers_action_random' => array(
      'label' => t('Generate a random number'),
      'new variables' => array(
        'random_number' => array(
          'type' => 'number',
          'label' => t('Random number'),
          'save' => TRUE,
        ),
      ),
      'module' => 'Rules Bonus: Numbers',
    ),
    'rb_numbers_action_sum' => array(
      'label' => t('Sum up numbers'),
      'new variables' => array(
        'sum' => array(
          'type' => 'number',
          'label' => t('Sum'),
          'save' => TRUE,
        ),
      ),
      'eval input' => array(
        'terms',
      ),
      'module' => 'Rules Bonus: Numbers',
    ),
    'rb_numbers_action_multiply' => array(
      'label' => t('Multiply numbers'),
      'new variables' => array(
        'product' => array(
          'type' => 'number',
          'label' => t('Product'),
          'save' => TRUE,
        ),
      ),
      'eval input' => array(
        'factors',
      ),
      'module' => 'Rules Bonus: Numbers',
    ),
  );

  // Add actions that depend on non-required modules.
  if (module_exists('views')) {
    $actions['rb_numbers_action_views_sum'] = array(
      'label' => t('Build a sum from Views'),
      'new variables' => array(
        'sum' => array(
          'type' => 'number',
          'label' => t('Sum'),
          'save' => TRUE,
        ),
      ),
      'eval input' => array(
        'args',
      ),
      'module' => 'Rules Bonus: Numbers',
    );
  }
  return $actions;
}