You are here

function _nodeformsettings_settings_form in Node and Comments Form Settings 7.3

Same name and namespace in other branches
  1. 6.3 includes/settings_node.inc \_nodeformsettings_settings_form()
  2. 6.2 includes/settings_node.inc \_nodeformsettings_settings_form()
  3. 7.2 includes/settings_node.inc \_nodeformsettings_settings_form()

Define all settings for nodes.

1 call to _nodeformsettings_settings_form()
nodeformsettings_form_alter in ./nodeformsettings.module
Implements hook_form_alter().

File

includes/settings_node.inc, line 6

Code

function _nodeformsettings_settings_form(&$form, $settings = NULL) {

  // The module is going to work with or without ctools.
  if (module_exists('ctools')) {
    ctools_include('dependent');
  }
  $defaults = nodeformsettings_elements_default();
  $options_en_ds = array(
    0 => t('Enabled'),
    1 => t('Disabled'),
  );
  $options_yes_no = array(
    0 => t('Yes'),
    1 => t('No'),
  );
  $form['nodeformsettings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node form settings'),
    '#collapsible' => TRUE,
    '#group' => 'additional_settings',
  );

  // Hide the Input Form Fieldset.
  $form['nodeformsettings']['nfs_inputformat'] = array(
    '#title' => t('Body field input text format'),
    '#type' => 'radios',
    '#options' => $options_en_ds,
    '#default_value' => isset($settings['nfs_inputformat']) ? $settings['nfs_inputformat'] : $defaults['nfs_inputformat'],
  );

  // Get form elements for cancel link.
  _nodeformsettings_settings_cancel_link_form($form, $settings, $options_yes_no);

  // Change the submit button text value.
  $form['nodeformsettings']['nfs_submit'] = array(
    '#title' => t('Submit button value'),
    '#type' => 'textfield',
    '#description' => t('Leave blank to restore default'),
    '#default_value' => isset($settings['nfs_submit']) ? $settings['nfs_submit'] : $defaults['nfs_submit'],
  );

  // Get form elements for vertical tab settings.
  _nodeformsettings_settings_vertical_tabs_form($form, $settings, $options_en_ds);

  // Get form elements for titles and description settings.
  _nodeformsettings_settings_titles_desc_form($form, $settings, $options_yes_no);

  // Get form elements for publishing options settings.
  _nodeformsettings_settings_publishing_options_form($form, $settings, $options_en_ds);
  $form['nodeformsettings']['set_default_to_all'] = array(
    '#type' => 'submit',
    '#value' => t('Set these node form settings as default'),
    '#submit' => array(
      'nodeformsettings_set_default_to_all',
    ),
    '#suffix' => '<div>' . t('Set these settings as default for all the content types') . '</div>',
  );
  $form['nodeformsettings']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset node form settings to default'),
    '#submit' => array(
      'nodeformsettings_reset_default',
    ),
    '#suffix' => '<div>' . t('Reset to default node form settings will clear custom changes to these settings.') . '</div>',
  );
  return $form;
}