You are here

function clone_settings in Node clone 5

Same name and namespace in other branches
  1. 5.2 clone.module \clone_settings()
  2. 6 clone.pages.inc \clone_settings()
  3. 7 clone.pages.inc \clone_settings()

menu callback to configure module settings.

1 string reference to 'clone_settings'
clone_menu in ./clone.module
Implementation of hook_menu().

File

./clone.module, line 81

Code

function clone_settings() {
  $form['heading'] = array(
    '#value' => '<b>' . t('Configuration options for the clone module:') . '</b>',
  );
  $form['clone_nodes_without_confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Clone nodes without requiring confirmation'),
    '#default_value' => variable_get('clone_nodes_without_confirm', FALSE),
    '#description' => t('If this is set, a new node will be created immediately upon clicking the "clone" tab when viewing a node.'),
  );
  $form['publishing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Should the publishing options ( e.g. published, promoted, etc) be reset to the defaults?'),
  );
  $types = node_get_types('names');
  foreach ($types as $type => $name) {
    $form['publishing']['clone_reset_' . $type] = array(
      '#type' => 'checkbox',
      '#title' => t('@s: reset publishing options when cloned', array(
        '@s' => $name,
      )),
      '#default_value' => variable_get('clone_reset_' . $type, FALSE),
    );
  }

  // Need the variable default key to be something that's never a valid node type.
  $types = array_merge(array(
    '!' => "<" . t("none") . ">",
  ), $types);
  $form['clone_omitted'] = array(
    '#type' => 'select',
    '#title' => t('Omitted content types'),
    '#default_value' => variable_get('clone_omitted', array(
      '!',
    )),
    '#options' => $types,
    '#description' => t('Select any node types which should <em>never</em> be cloned. Typically you should will want to select here all node types for which cloning fails (e.g. image nodes).'),
    '#multiple' => TRUE,
  );
  $form['clone_method'] = array(
    '#type' => 'value',
    '#value' => 'save-edit',
  );
  return system_settings_form($form);
}