You are here

function node_rules_event_info in Rules 6

Implementation of hook_rules_event_info()

Related topics

File

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

Code

function node_rules_event_info() {
  $items = array(
    'node_insert' => array(
      'label' => t('After saving new content'),
      'module' => 'Node',
      'arguments' => rules_events_node_arguments(t('created content'), t("content's author")),
    ),
    'node_update' => array(
      'label' => t('After updating existing content'),
      'module' => 'Node',
      'arguments' => rules_events_node_arguments(t('updated content'), t("content's author"), TRUE),
    ),
    'node_presave' => array(
      'label' => t('Content is going to be saved'),
      'module' => 'Node',
      'arguments' => rules_events_node_arguments(t('saved content'), t("content's author"), TRUE),
    ),
    'node_view' => array(
      'label' => t('Content is going to be viewed'),
      'module' => 'Node',
      'help' => t("Note that if drupal's page cache is enabled, this event won't be generated for pages served from cache."),
      'arguments' => rules_events_node_arguments(t('viewed content'), t('content author')) + array(
        'teaser' => array(
          'type' => 'boolean',
          'label' => t('Content is displayed as teaser'),
        ),
        'page' => array(
          'type' => 'boolean',
          'label' => t('Content is displayed as page'),
        ),
      ),
    ),
    'node_delete' => array(
      'label' => t('After deleting content'),
      'module' => 'Node',
      'arguments' => rules_events_node_arguments(t('deleted content'), t('content author')),
    ),
  );

  // Specify that on presave the node is saved anyway.
  $items['node_presave']['arguments']['node']['saved'] = TRUE;
  return $items;
}