You are here

function radioactivity_rules_action_info in Radioactivity 7.2

Implements hook_rules_action_info().

File

./radioactivity.rules.inc, line 6

Code

function radioactivity_rules_action_info() {
  $items = array();
  $defaults = array(
    'group' => t('Radioactivity'),
    'access callback' => 'radioactivity_access_callback',
  );

  // Emit energy
  $items['radioactivity_emit'] = $defaults + array(
    'label' => t('Add an incident to a field'),
    'base' => 'radioactivity_rules_action_emit',
    'parameter' => array(
      'data' => array(
        'type' => '*',
        'label' => t('Radioactivity field'),
        'description' => t('The radioactivity field in which you want to add an incident to'),
        'restriction' => 'selector',
        'wrapped' => TRUE,
        'allow null' => TRUE,
      ),
      'value' => array(
        'type' => 'decimal',
        'label' => t('Energy amount'),
        'description' => t('The variable which contains the amount of energy to be added to or substracted from the field'),
        'allow null' => FALSE,
        'optional' => FALSE,
      ),
      'floodcheck' => array(
        'type' => 'boolean',
        'label' => t('Flood protected'),
        'description' => t('If checked the emitter has to pass flood check.'),
        'allow null' => FALSE,
        'optional' => TRUE,
      ),
    ),
  );

  // Emit energy
  $items['radioactivity_add_emitter'] = $defaults + array(
    'label' => t('Add an ajax emitter on page'),
    'base' => 'radioactivity_rules_action_add_emitter',
    'parameter' => array(
      'data' => array(
        'type' => '*',
        'label' => t('Radioactivity field'),
        'description' => t('The radioactivity field which will be added to the page as an emitter'),
        'restriction' => 'selector',
        'wrapped' => TRUE,
        'allow null' => TRUE,
      ),
      'energy' => array(
        'type' => 'decimal',
        'label' => t('Energy'),
        'description' => t('The variable which contains the amount of energy to emit'),
        'allow null' => FALSE,
        'optional' => FALSE,
      ),
      'accuracy' => array(
        'type' => 'decimal',
        'label' => t('Accuracy'),
        'description' => t('The variable which contains the accuracy of this emitter'),
        'allow null' => FALSE,
        'optional' => FALSE,
      ),
    ),
  );

  // Set energy
  $items['radioactivity_set'] = $defaults + array(
    'label' => t('Set the energy of a field'),
    'base' => 'radioactivity_rules_action_set',
    'parameter' => array(
      'data' => array(
        'type' => '*',
        'label' => t('Radioactivity field'),
        'description' => t('The radioactivity field which you wish to set'),
        'restriction' => 'selector',
        'wrapped' => TRUE,
        'allow null' => TRUE,
      ),
      'value' => array(
        'type' => 'decimal',
        'label' => t('Energy level'),
        'description' => t('The variable which contains the new energy level for the field'),
        'allow null' => FALSE,
        'optional' => FALSE,
      ),
    ),
  );

  // Get maximum
  $items['radioactivity_maximum'] = $defaults + array(
    'label' => t('Get the maximum energy from a field'),
    'base' => 'radioactivity_rules_action_maximum',
    'parameter' => array(
      'data' => array(
        'type' => '*',
        'label' => t('Radioactivity field'),
        'description' => t('The radioactivity field from which you want the maximum energy to be retrieved from'),
        'restriction' => 'selector',
        'wrapped' => TRUE,
        'allow null' => FALSE,
      ),
    ),
    'provides' => array(
      'maximum_energy' => array(
        'type' => 'decimal',
        'label' => t('Maximum energy'),
      ),
    ),
  );
  return $items;
}