You are here

function ds_extras_form_node_type_form_alter in Display Suite 7.2

Implements hook_form_FORM_ID_alter().

File

modules/ds_extras/ds_extras.module, line 345
Display Suite extras main functions.

Code

function ds_extras_form_node_type_form_alter(&$form, $form_state, $form_id) {
  $node_type = $form['#node_type']->type;

  // Get the view modes.
  $options = ds_extras_get_bundle_view_modes('node', $node_type);

  // Only fire if we have more than 1 option.
  if (count($options) > 1) {
    if (!isset($form['ds_extras'])) {
      $form['ds_extras'] = array(
        '#type' => 'fieldset',
        '#title' => t('Display Suite: Extras'),
        // There's already a 'Display settings' fieldset
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#group' => 'additional_settings',
        '#weight' => 100,
      );
    }
    $form['ds_extras']['ds_extras_view_modes'] = array(
      '#type' => 'checkboxes',
      '#title' => t('View modes'),
      '#options' => $options,
      '#default_value' => variable_get('ds_extras_view_modes_' . $node_type, array_keys($options)),
      '#description' => t('Select which view modes will be available to switch to on node edit forms.'),
    );
  }
}