You are here

function scheduler_rules_event_info in Scheduler 7

Implements hook_rules_event_info().

This hook function defines four Scheduler events which can be used by Rules to trigger other actions.

File

./scheduler.rules.inc, line 14
Scheduler rules functions.

Code

function scheduler_rules_event_info() {

  // Create an array of variables, as these are the same for each of the events.
  $variables = array(
    'node' => array(
      'type' => 'node',
      'label' => t('Scheduled Content Node'),
      'description' => t('The node object representing the scheduled content'),
    ),
    // Use both dates in all rules to give maximum flexibility for use within a
    // single event. The two dates do exist in the $node object, but will be 0
    // if no date is entered. Including the specific date variables gives more
    // flexibility because any non-entered date will be blank here not zero.
    'publish_on' => array(
      'type' => 'date',
      'label' => t('Scheduler Publish On date'),
      'description' => t('Date and time that the node will be published by Scheduler'),
    ),
    'unpublish_on' => array(
      'type' => 'date',
      'label' => t('Scheduler Unpublish On date'),
      'description' => t('Date and time that the node will be unpublished by Scheduler'),
    ),
  );

  // Define the events.
  $items = array(
    'scheduler_new_node_is_scheduled_for_publishing_event' => array(
      'label' => t('After saving new content that is scheduled for publishing'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
    'scheduler_existing_node_is_scheduled_for_publishing_event' => array(
      'label' => t('After updating existing content that is scheduled for publishing'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
    'scheduler_new_node_is_scheduled_for_unpublishing_event' => array(
      'label' => t('After saving new content that is scheduled for unpublishing'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
    'scheduler_existing_node_is_scheduled_for_unpublishing_event' => array(
      'label' => t('After updating existing content that is scheduled for unpublishing'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
    'scheduler_node_has_been_published_event' => array(
      'label' => t('After a node has been published by Scheduler'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
    'scheduler_node_has_been_unpublished_event' => array(
      'label' => t('After a node has been unpublished by Scheduler'),
      'group' => t('Scheduler'),
      'variables' => $variables,
    ),
  );
  return $items;
}