function rules_node_event_info

Implements hook_rules_event_info() on behalf of the node module.

Related topics

File

modules/node.rules.inc, line 34

Code

function rules_node_event_info() {
    $items = array(
        'node_insert' => array(
            'label' => t('After saving new content'),
            'category' => 'node',
            'variables' => rules_events_node_variables(t('created content')),
            'access callback' => 'rules_node_integration_access',
            'class' => 'RulesNodeEventHandler',
        ),
        'node_update' => array(
            'label' => t('After updating existing content'),
            'category' => 'node',
            'variables' => rules_events_node_variables(t('updated content'), TRUE),
            'access callback' => 'rules_node_integration_access',
            'class' => 'RulesNodeEventHandler',
        ),
        'node_presave' => array(
            'label' => t('Before saving content'),
            'category' => 'node',
            'variables' => rules_events_node_variables(t('saved content'), TRUE),
            'access callback' => 'rules_node_integration_access',
            'class' => 'RulesNodeEventHandler',
        ),
        'node_view' => array(
            'label' => t('Content is viewed'),
            'category' => 'node',
            'help' => t("Note that if drupal's page cache is enabled, this event won't be generated for pages served from cache."),
            'variables' => rules_events_node_variables(t('viewed content')) + array(
                'view_mode' => array(
                    'type' => 'text',
                    'label' => t('view mode'),
                    'options list' => 'rules_get_entity_view_modes',
                    // Add the entity-type for the options list callback.
'options list entity type' => 'node',
                ),
            ),
            'access callback' => 'rules_node_integration_access',
            'class' => 'RulesNodeEventHandler',
        ),
        'node_delete' => array(
            'label' => t('After deleting content'),
            'category' => 'node',
            'variables' => rules_events_node_variables(t('deleted content')),
            'access callback' => 'rules_node_integration_access',
            'class' => 'RulesNodeEventHandler',
        ),
    );
    // Specify that on presave the node is saved anyway.
    $items['node_presave']['variables']['node']['skip save'] = TRUE;
    return $items;
}