You are here

function views_ui_admin_settings_basic in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 views_ui/admin.inc \views_ui_admin_settings_basic()

Form builder for the admin display defaults page.

1 string reference to 'views_ui_admin_settings_basic'
views_ui_menu in ./views_ui.module
Implements hook_menu().

File

includes/admin.inc, line 4934
Provides the Views' administrative interface.

Code

function views_ui_admin_settings_basic() {
  $form = array();
  $form['#attached']['css'] = views_ui_get_admin_css();
  $options = array();
  foreach (list_themes() as $name => $theme) {
    if ($theme->status) {
      $options[$name] = $theme->info['name'];
    }
  }

  // This is not currently a fieldset but we may want it to be later,
  // so this will make it easier to change if we do.
  $form['basic'] = array();
  $form['basic']['views_ui_show_listing_filters'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show filters on the list of views'),
    '#default_value' => variable_get('views_ui_show_listing_filters', FALSE),
  );
  $form['basic']['views_ui_show_advanced_help_warning'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show advanced help warning'),
    '#default_value' => variable_get('views_ui_show_advanced_help_warning', TRUE),
  );
  $form['basic']['views_ui_show_master_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Always show the master (default) display'),
    '#description' => t('Advanced users of views may choose to see the master (i.e. default) display.'),
    '#default_value' => variable_get('views_ui_show_master_display', FALSE),
  );
  $form['basic']['views_ui_show_advanced_column'] = array(
    '#type' => 'checkbox',
    '#title' => t('Always show advanced display settings'),
    '#description' => t('Default to showing advanced display settings, such as relationships and contextual filters.'),
    '#default_value' => variable_get('views_ui_show_advanced_column', FALSE),
  );
  $form['basic']['views_ui_display_embed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show the embed display in the ui.'),
    '#description' => t('Allow advanced user to use the embed view display. The plugin itself works if it\'s not visible in the ui'),
    '#default_value' => variable_get('views_ui_display_embed', FALSE),
  );
  $form['basic']['views_ui_custom_theme'] = array(
    '#type' => 'select',
    '#title' => t('Custom admin theme for the Views UI'),
    '#options' => array(
      '_default' => t('- Use default -'),
    ) + $options,
    '#default_value' => variable_get('views_ui_custom_theme', '_default'),
    '#description' => t('In some cases you might want to select a different admin theme for the Views UI.'),
  );
  $form['basic']['views_exposed_filter_any_label'] = array(
    '#type' => 'select',
    '#title' => t('Label for "Any" value on non-required single-select exposed filters'),
    '#options' => array(
      'old_any' => '<Any>',
      'new_any' => t('- Any -'),
    ),
    '#default_value' => variable_get('views_exposed_filter_any_label', 'new_any'),
  );
  $form['live_preview'] = array(
    '#type' => 'fieldset',
    '#title' => t('Live preview settings'),
  );
  $form['live_preview']['views_ui_always_live_preview'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically update preview on changes'),
    '#default_value' => variable_get('views_ui_always_live_preview', TRUE),
  );

  // $form['live_preview']['views_ui_always_live_preview_button'] = array(
  //   '#type' => 'checkbox',
  //   '#title' => t('Always show the preview button, even when the automatically update option is checked'),
  //   '#default_value' => variable_get('views_ui_always_live_preview_button', FALSE),
  // );
  $form['live_preview']['views_ui_show_preview_information'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show information and statistics about the view during live preview'),
    '#default_value' => variable_get('views_ui_show_preview_information', TRUE),
  );
  $form['live_preview']['views_ui_show_sql_query_where'] = array(
    '#type' => 'radios',
    '#options' => array(
      'above' => t('Above the preview'),
      'below' => t('Below the preview'),
    ),
    '#id' => 'edit-show-sql',
    '#default_value' => variable_get('views_ui_show_sql_query_where', 'above'),
    '#dependency' => array(
      'edit-views-ui-show-preview-information' => array(
        TRUE,
      ),
    ),
    '#prefix' => '<div id="edit-show-sql-wrapper" class="views-dependent">',
    '#suffix' => '</div>',
  );
  $form['live_preview']['views_ui_show_sql_query'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show the SQL query'),
    '#default_value' => variable_get('views_ui_show_sql_query', FALSE),
    '#dependency' => array(
      'edit-views-ui-show-preview-information' => array(
        TRUE,
      ),
    ),
  );
  $form['live_preview']['views_ui_show_performance_statistics'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show performance statistics'),
    '#default_value' => variable_get('views_ui_show_performance_statistics', FALSE),
    '#dependency' => array(
      'edit-views-ui-show-preview-information' => array(
        TRUE,
      ),
    ),
  );
  $form['live_preview']['views_show_additional_queries'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show other queries run during render during live preview'),
    '#description' => t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."),
    '#default_value' => variable_get('views_show_additional_queries', FALSE),
    '#dependency' => array(
      'edit-views-ui-show-preview-information' => array(
        TRUE,
      ),
    ),
  );

  // $form['live_preview']['views_ui_show_performance_statistics_where'] = array(
  return system_settings_form($form);
}