You are here

function rules_node_action_info in Rules 7.2

Implements hook_rules_action_info() on behalf of the node module.

Related topics

File

modules/node.rules.inc, line 108
Rules integration for the node module.

Code

function rules_node_action_info() {
  $defaults = array(
    'parameter' => array(
      'node' => array(
        'type' => 'node',
        'label' => t('Content'),
        'save' => TRUE,
      ),
    ),
    'category' => 'node',
    'access callback' => 'rules_node_admin_access',
  );

  // Add support for hand-picked core actions.
  $core_actions = node_action_info();
  $actions = array(
    'node_publish_action',
    'node_unpublish_action',
    'node_make_sticky_action',
    'node_make_unsticky_action',
    'node_promote_action',
    'node_unpromote_action',
  );
  foreach ($actions as $base) {
    $action_name = str_replace('_action', '', $base);
    $items[$action_name] = $defaults + array(
      'label' => $core_actions[$base]['label'],
      'base' => $base,
    );
  }
  return $items;
}