You are here

function scheduler_preprocess_node in Scheduler 7

Same name and namespace in other branches
  1. 8 scheduler.module \scheduler_preprocess_node()
  2. 6 scheduler.module \scheduler_preprocess_node()

Prepares variables for node templates.

Makes the publish_on and unpublish_on data available as theme variables.

See also

template_preprocess_node()

File

./scheduler.module, line 827
Scheduler publishes and unpublishes nodes on dates specified by the user.

Code

function scheduler_preprocess_node(&$variables) {
  $node = $variables['node'];
  $date_format = variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT);
  if (!empty($node->publish_on) && $node->publish_on && is_numeric($node->publish_on)) {
    $variables['publish_on'] = format_date($node->publish_on, 'custom', $date_format);
  }
  if (!empty($node->unpublish_on) && $node->unpublish_on && is_numeric($node->unpublish_on)) {
    $variables['unpublish_on'] = format_date($node->unpublish_on, 'custom', $date_format);
  }
}