You are here

function rb_misc_rules_action_info in Rules Bonus Pack 6

Same name and namespace in other branches
  1. 7 rb_misc.rules.inc \rb_misc_rules_action_info()

Implementation of hook_rules_action_info().

File

./rb_misc.module, line 37
Miscellaneous conditions and actions for Rules.

Code

function rb_misc_rules_action_info() {

  // Add the actions relevant for required core modules.
  $actions = array(
    'rb_misc_action_arg' => array(
      'label' => t('Load path argument'),
      'new variables' => array(
        'arg_part' => array(
          'type' => 'string',
          'label' => t('Path argument'),
          'save' => TRUE,
        ),
      ),
      'module' => 'Rules Bonus: Misc',
    ),
    'rb_misc_action_get_time' => array(
      'label' => t('Get a string with current time'),
      'new variables' => array(
        'current_time' => array(
          'type' => 'string',
          'label' => t('Current time'),
          'save' => TRUE,
        ),
      ),
      'module' => 'Rules Bonus: Misc',
    ),
    'rb_misc_action_variable_get' => array(
      'label' => t('Load a system variable'),
      'new variables' => array(
        'variable' => array(
          'type' => 'string',
          'label' => t('System variable'),
          'save' => TRUE,
        ),
      ),
      'module' => 'Rules Bonus: Misc',
    ),
    'rb_misc_action_set_node_creation_time' => array(
      'label' => t('Set node creation time'),
      'arguments' => array(
        'node' => array(
          'type' => 'node',
          'label' => t('Node to give new post time'),
        ),
      ),
      'eval input' => array(
        'time',
      ),
      'module' => 'Rules Bonus: Misc',
    ),
  );

  // Add actions that depend on non-required modules.
  if (module_exists('path')) {
    $actions['rb_misc_action_get_url_alias'] = array(
      'label' => t('Get URL alias for an internal path'),
      'new variables' => array(
        'alias' => array(
          'type' => 'string',
          'label' => t('URL alias'),
          'save' => TRUE,
        ),
      ),
      'eval input' => array(
        'path',
      ),
      'module' => 'Rules Bonus: Misc',
    );
  }
  if (module_exists('views')) {
    $actions['rb_misc_action_views_load_node'] = array(
      'label' => t('Use Views to load a node'),
      'new variables' => array(
        'node' => array(
          'type' => 'node',
          'label' => t('Views-provided node'),
          'save' => TRUE,
        ),
      ),
      'eval input' => array(
        'args',
      ),
      'module' => 'Rules Bonus: Misc',
    );
  }
  if (module_exists('menu') && module_exists('menu_position')) {
    $actions['rb_misc_action_set_active_menu_item'] = array(
      'label' => t('Set the active menu item'),
      'module' => 'Rules Bonus: Misc',
    );
  }
  if (module_exists('feeds')) {
    $actions['rb_misc_action_get_import_nid'] = array(
      'label' => t('Get import nid for content'),
      'arguments' => array(
        'node' => array(
          'type' => 'node',
          'label' => t('Imported content'),
        ),
      ),
      'new variables' => array(
        'import_nid' => array(
          'type' => 'string',
          'label' => t('nid for import node'),
          'save' => TRUE,
        ),
      ),
      'module' => 'Course web',
    );
  }
  return $actions;
}