You are here

function scheduler_node_import_defaults in Node import 6

Implementation of hook_node_import_defaults().

File

supported/scheduler/scheduler.inc, line 47
Support file for the contrib scheduler module.

Code

function scheduler_node_import_defaults($type, $defaults, $fields, $map) {
  $form = array();
  if (($node_type = node_import_type_is_node($type)) !== FALSE && user_access('schedule (un)publishing of nodes')) {
    if (variable_get('scheduler_publish_enable_' . $node_type, 0) == 1) {
      $form['publish_on'] = array(
        '#type' => 'textfield',
        '#title' => t('Publish on'),
        '#maxlength' => 25,
        '#default_value' => isset($defaults['publish_on']) ? $defaults['publish_on'] : '',
      );
    }
    if (variable_get('scheduler_unpublish_enable_' . $node_type, 0) == 1) {
      $form['unpublish_on'] = array(
        '#type' => 'textfield',
        '#title' => t('Unpublish on'),
        '#maxlength' => 25,
        '#default_value' => isset($defaults['unpublish_on']) ? $defaults['unpublish_on'] : '',
      );
    }
  }
  return $form;
}