You are here

function ds_extras_settings in Display Suite 7.2

Same name and namespace in other branches
  1. 7 modules/ds_extras/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/includes/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');
  $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>CSS classes</label>You can add custom CSS classes on the <a href="!url">classes form</a>. Display Suite UI needs to be enabled for this. These classes 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/classes'),
    )),
    '#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,
        ),
      ),
    ),
  );
  $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_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),
  );
  $form['additional_settings']['fs4']['ds_extras_hide_page_sidebars'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable Drupal blocks/regions'),
    '#description' => t('Add ability to disable all sidebar regions displayed in the theme. Note that some themes support this setting better than others. If in doubt, try with stock themes to see.'),
    '#default_value' => variable_get('ds_extras_hide_page_sidebars', FALSE),
  );
  $form['additional_settings']['fs4']['ds_extras_field_permissions'] = array(
    '#type' => 'checkbox',
    '#title' => t('Field permissions'),
    '#description' => t('Enables view permissions on all Display Suite fields.'),
    '#default_value' => variable_get('ds_extras_field_permissions', FALSE),
  );
  $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),
    );
  }
  if (module_exists('flag')) {
    $form['additional_settings']['fs4']['ds_extras_flag'] = array(
      '#type' => 'checkbox',
      '#title' => t('Flag'),
      '#description' => t('Expose flags as fields on nodes.'),
      '#default_value' => variable_get('ds_extras_flag', 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. It does not work in combination with the reset layout.'),
    '#default_value' => variable_get('ds_extras_switch_field', 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),
  );
  $form['#attached']['js'][] = drupal_get_path('module', 'ds_extras') . '/js/ds_extras.admin.js';
  $form = system_settings_form($form);
  $form['#submit'][] = 'ds_extras_settings_submit';
  return $form;
}