You are here

function ds_extras_settings in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.admin.inc \ds_extras_settings()

Menu callback: Display Suite extras settings.

1 string reference to 'ds_extras_settings'
ds_extras_menu in modules/ds_extras/ds_extras.module
Implements hook_menu().

File

modules/ds_extras/ds_extras.admin.inc, line 11
Display Suite Extras administrative functions.

Code

function ds_extras_settings($form) {
  $form['additional_settings'] = array(
    '#type' => 'vertical_tabs',
    '#theme_wrappers' => array(
      'vertical_tabs',
    ),
    '#prefix' => '<div>',
    '#suffix' => '</div>',
    '#tree' => TRUE,
  );
  $form['additional_settings']['fs1'] = array(
    '#type' => 'fieldset',
    '#title' => t('Field Templates'),
  );
  $form['additional_settings']['fs1']['ds_extras_field_template'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Field Templates'),
    '#description' => t('Customize the labels and the HTML output of your fields.'),
    '#default_value' => variable_get('ds_extras_field_template', FALSE),
  );
  $theme_functions = module_invoke_all('ds_field_theme_functions_info');
  unset($theme_functions['theme_ds_field_expert']);
  $form['additional_settings']['fs1']['ft-default'] = array(
    '#type' => 'select',
    '#title' => t('Default Field Template'),
    '#options' => $theme_functions,
    '#default_value' => variable_get('ft-default', 'theme_field'),
    '#description' => t('Default will output the field as defined in Drupal Core.<br />Reset will strip all HTML.<br />Minimal adds a simple wrapper around the field.<br/>There is also an Expert Field Template that gives full control over the HTML, but can only be set per field.<br /><br />You can override this setting per field on the "Manage display" screens or when creating fields on the instance level.<br /><br /><strong>Template suggestions</strong><br />You can create .tpl files as well for these field theme functions, e.g. field--reset.tpl.php, field--minimal.tpl.php<br /><br /><label>Styles</label>You can add custom styles on the <a href="!url">styles form</a>. These styles can be added to fields using the Default Field Template.<br /><br /><label>Advanced</label>You can create your own custom field templates which need to be defined with hook_ds_field_theme_functions_info(). See ds.api.php for an example.', array(
      '!url' => url('admin/structure/ds/styles'),
    )),
    '#states' => array(
      'visible' => array(
        'input[name="additional_settings[fs1][ds_extras_field_template]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['additional_settings']['fs1']['ft-kill-colon'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide colon'),
    '#default_value' => variable_get('ft-kill-colon', FALSE),
    '#description' => t('Hide the colon on the reset field template.'),
    '#states' => array(
      'visible' => array(
        'select[name="additional_settings[fs1][ft-default]"]' => array(
          'value' => 'theme_ds_field_reset',
        ),
        'input[name="additional_settings[fs1][ds_extras_field_template]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['additional_settings']['fs2'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extra fields'),
  );
  $form['additional_settings']['fs2']['ds_extras_fields_extra'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable extra fields'),
    '#description' => t('Make fields from other modules available on the "Manage display" screens.'),
    '#default_value' => variable_get('ds_extras_fields_extra', FALSE),
  );
  $form['additional_settings']['fs2']['ds_extras_fields_extra_list'] = array(
    '#type' => 'textarea',
    '#description' => t('Enter fields line by line, where each line is a combination of entity type, bundle and field name. E.g. node|article|tweetbutton. It might be possible that the actual content of the field depends on configuration of that field/module.'),
    '#default_value' => variable_get('ds_extras_fields_extra_list', FALSE),
    '#states' => array(
      'visible' => array(
        'input[name="additional_settings[fs2][ds_extras_fields_extra]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  if (module_exists('panels')) {
    $form['additional_settings']['fs3'] = array(
      '#type' => 'fieldset',
      '#title' => t('Panel view modes'),
    );
    $form['additional_settings']['fs3']['ds_extras_panel_view_modes'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use the Panels editor on the \'Manage Display\' screen'),
      '#description' => t('Use the Panels editor instead of Field UI to manage your layout. Note that this feature is better managed by the 7.x-3.x branch of the Panelizer project.'),
      '#default_value' => variable_get('ds_extras_panel_view_modes', FALSE),
    );
    $form['additional_settings']['fs3']['ds_extras_editor_switch'] = array(
      '#type' => 'checkbox',
      '#title' => t('Switch layout editor'),
      '#description' => t('Keep the option to switch between Field UI or Panels. Note: any layout configured already with Field UI will be kept.'),
      '#default_value' => variable_get('ds_extras_editor_switch', FALSE),
      '#states' => array(
        'visible' => array(
          'input[name="additional_settings[fs3][ds_extras_panel_view_modes]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
  }
  $form['additional_settings']['fs4'] = array(
    '#type' => 'fieldset',
    '#title' => t('Other'),
  );
  $form['additional_settings']['fs4']['ds_extras_switch_view_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('View mode per node'),
    '#description' => t('Change view modes for individual nodes. A new tab \'Display settings\' will appear on the content create form.<br />You can also pass the name of a view mode through the URL, eg node/x?v=full.<br />If you install the Page manager module and override the node view, Page manager will win.'),
    '#default_value' => variable_get('ds_extras_switch_view_mode', FALSE),
  );
  $form['additional_settings']['fs4']['ds_extras_switch_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('View mode switcher'),
    '#description' => t('Adds a field with links to switch view modes inline with Ajax. Only works for nodes at this time.'),
    '#default_value' => variable_get('ds_extras_switch_field', FALSE),
  );
  $form['additional_settings']['fs4']['ds_extras_revision_view_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Revision view mode'),
    '#description' => t('Make new view mode "Revision" available which can be used to style the revision of a node.'),
    '#default_value' => variable_get('ds_extras_revision_view_mode', FALSE),
  );
  $form['additional_settings']['fs4']['ds_extras_hidden_region'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hidden region'),
    '#description' => t('Add a hidden region to the layouts. Fields will be built but not printed.'),
    '#default_value' => variable_get('ds_extras_hidden_region', FALSE),
  );
  if (module_exists('contextual') && module_exists('field_ui')) {
    $form['additional_settings']['fs4']['ds_extras_contextual'] = array(
      '#type' => 'checkbox',
      '#title' => t('Contextual links'),
      '#description' => t('Add contextual links (if possible) to manage the layout.'),
      '#default_value' => variable_get('ds_extras_contextual', FALSE),
    );
  }
  $form['additional_settings']['fs4']['ds_extras_hide_page_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Page title options'),
    '#description' => t('Hide or manually set the page title of the "Full content" view mode.'),
    '#default_value' => variable_get('ds_extras_hide_page_title', FALSE),
  );
  if (module_exists('block')) {
    $form['additional_settings']['fs4']['ds_extras_region_to_block'] = array(
      '#type' => 'checkbox',
      '#title' => t('Region to block'),
      '#description' => t('Create additional regions exposed as block. Note: this will not work on the default view mode.'),
      '#default_value' => variable_get('ds_extras_region_to_block', FALSE),
    );
  }
  if (module_exists('views')) {
    $form['additional_settings']['fs4']['ds_extras_vd'] = array(
      '#type' => 'checkbox',
      '#title' => t('Views displays'),
      '#description' => t('Manage the layout of your Views layout with Field UI at !url.', array(
        '!url' => l(url('admin/structure/ds/vd', array(
          'absolute' => TRUE,
        )), 'admin/structure/ds/vd'),
      )),
      '#default_value' => variable_get('ds_extras_vd', FALSE),
    );
  }
  $form['#attached']['js'][] = drupal_get_path('module', 'ds_extras') . '/ds_extras.admin.js';
  $form = system_settings_form($form);
  $form['#submit'][] = 'ds_extras_settings_submit';
  return $form;
}