You are here

function node_export_settings in Node export 6.3

Same name and namespace in other branches
  1. 6.2 node_export.module \node_export_settings()
  2. 7.3 node_export.pages.inc \node_export_settings()

Menu callback to configure module settings.

2 string references to 'node_export_settings'
node_export_file_form_alter in modules/node_export_file/node_export_file.module
Implementation of hook_form_alter().
node_export_menu in ./node_export.module
Implementation of hook_menu().

File

./node_export.pages.inc, line 69
The Node export pages file.

Code

function node_export_settings() {
  $types = node_get_types('names');
  menu_rebuild();
  $form['basic'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
  );
  $format_handlers = node_export_format_handlers();
  $format_options = array();
  foreach ($format_handlers as $format_handler => $format) {
    $format_options[$format_handler] = $format['#title'];
  }
  asort($format_options);
  $selected_formats = variable_get('node_export_format', array(
    'node_code',
  ));
  if (!count(array_filter($selected_formats))) {
    $selected_formats = array(
      'node_code',
    );
  }
  if (count($format_options) > 1) {
    $form['basic']['node_export_format'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Format to use when exporting a node'),
      '#default_value' => $selected_formats,
      '#options' => $format_options,
      '#description' => t("If you select multiple formats, they will all be available to the user.  If you select none, or the format handler is not found, it will use the default 'Node code'.  This does not affect imports, the required import format will be used automatically."),
    );
  }
  else {
    $format = key($format_options);
    $form['basic']['node_export_format'] = array(
      '#type' => 'value',
      '#value' => array(
        $format => $format,
      ),
    );
  }
  $form['basic']['node_export_code'] = array(
    '#type' => 'radios',
    '#title' => t('Node export code delivery'),
    '#options' => array(
      'all' => t('All of the below options on a page'),
      'copy' => t('Textarea filled with export code'),
      'file' => t('Text file download'),
    ),
    '#default_value' => variable_get('node_export_code', 'all'),
  );
  $form['basic']['filename'] = array(
    '#type' => 'fieldset',
    '#title' => t('Filename settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['basic']['filename']['node_export_filename'] = array(
    '#type' => 'textfield',
    '#title' => t('Filename pattern'),
    '#default_value' => variable_get('node_export_filename', 'node-export[nid-list]([node-count]-nodes).[timestamp].[format]'),
    '#size' => 120,
  );
  node_export_settings_token_bits($form['basic']['filename'], 'node_export_filename');
  $form['basic']['filename']['node_export_file_list'] = array(
    '#type' => 'textfield',
    '#title' => t('Node ID list max'),
    '#default_value' => variable_get('node_export_file_list', 10),
    '#size' => 6,
    '#maxlength' => 30,
    '#description' => t('If there are more than this many nodes, the [nid-list] token for the filename will not be built.  This is to prevent very long filenames.'),
  );
  $form['basic']['node_export_existing'] = array(
    '#type' => 'radios',
    '#title' => t('When importing a node that already exists'),
    '#options' => array(
      'new' => t('Create a new node'),
      'revision' => t('Create a new revision of the existing node'),
      'skip' => t('Skip the node'),
    ),
    '#description' => t('UUIDs are used to uniquely identify nodes.'),
    '#default_value' => variable_get('node_export_existing', 'new'),
  );
  $form['publishing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Reset values on import'),
  );
  foreach ($types as $type => $name) {
    $form['publishing'][$type] = array(
      '#type' => 'fieldset',
      '#title' => $name,
      '#description' => t('Reset these values when importing nodes of type @s.', array(
        '@s' => $name,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['publishing'][$type]['node_export_reset_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Publishing options (status, moderate, promote, sticky, and revision)'),
      '#default_value' => variable_get('node_export_reset_' . $type, FALSE),
    );
    $form['publishing'][$type]['node_export_reset_created_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Created time (<em>Authored on</em> date/time)'),
      '#default_value' => variable_get('node_export_reset_created_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_changed_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Changed time (<em>Last updated</em> date/time)'),
      '#default_value' => variable_get('node_export_reset_changed_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_revision_timestamp_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Revision changed time'),
      '#default_value' => variable_get('node_export_reset_revision_timestamp_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_last_comment_timestamp_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Last comment time (date/time the last comment was made)'),
      '#default_value' => variable_get('node_export_reset_last_comment_timestamp_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_menu_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Menu link'),
      '#default_value' => variable_get('node_export_reset_menu_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_path_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('URL path'),
      '#default_value' => variable_get('node_export_reset_path_' . $type, TRUE),
    );
    $form['publishing'][$type]['node_export_reset_book_mlid_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('Book menu link'),
      '#default_value' => variable_get('node_export_reset_book_mlid_' . $type, TRUE),
    );
  }
  return system_settings_form($form);
}