1 views_ui.admin.inc | views_ui_admin_settings_basic() |
Form builder for the admin display defaults page.
File
- core/
modules/ views_ui/ views_ui.admin.inc, line 4510 - Admin page callbacks for the Views UI module.
Code
function views_ui_admin_settings_basic() {
$form = array();
$form['#attached']['css'] = views_ui_get_admin_css();
$config = config('views_ui.settings');
$form['wizard'] = array(
'#type' => 'fieldset',
'#title' => t("'Add view' wizard"),
);
$form['wizard']['wizard_default_display'] = array(
'#type' => 'checkboxes',
'#title' => t('Display types to include by default'),
'#description' => t("These display types will be selected by default when a new view is created using the '!add_view' wizard.", array('!add_view' => l(t('Add View'), 'admin/structure/views/add'))),
'#options' => array(
'page' => t('Page'),
'block' => t('Block'),
),
'#default_value' => $config->get('wizard_default_display'),
);
$form['basic'] = array(
'#type' => 'fieldset',
'#title' => t('Views UI settings'),
);
$form['basic']['show_default_display'] = array(
'#type' => 'checkbox',
'#title' => t('Always show the <em>Default</em> display'),
'#description' => t('Show the <em>Default</em> (i.e. default) display, which is otherwise hidden.'),
'#default_value' => $config->get('show_default_display'),
);
$form['basic']['display_embed'] = array(
'#type' => 'checkbox',
'#title' => t('Allow <em>embed</em> displays to be created via the UI'),
'#description' => t('Enables the <em>embed</em> type of display. Embed displays can be used in code via <a href="@api_link"><code>views_embed_view()</code></a>. Embedded displays will still work even if this setting is disabled.', array('@api_link' => url('https://docs.backdropcms.org/api/backdrop/core%21modules%21views%21views.module/function/views_embed_view'))),
'#default_value' => $config->get('display_embed'),
);
$options = array();
foreach (list_themes() as $name => $theme) {
if ($theme->status) {
$options[$name] = $theme->info['name'];
}
}
$form['basic']['custom_theme'] = array(
'#type' => 'select',
'#title' => t('Custom admin theme for the Views UI'),
'#options' => array('_default' => t('- Use default -')) + $options,
'#default_value' => $config->get('custom_theme'),
'#description' => t('In some cases you might want to select a different admin theme for the Views UI.')
);
$form['basic']['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' => config_get('views.settings', 'exposed_filter_any_label'),
);
$form['live_preview'] = array(
'#type' => 'fieldset',
'#title' => t('Live preview settings'),
);
$form['live_preview']['always_live_preview'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically update preview on changes'),
'#default_value' => $config->get('always_live_preview'),
);
$form['live_preview']['show_preview_information'] = array(
'#type' => 'checkbox',
'#title' => t('Show information and statistics about the view during live preview'),
'#default_value' => $config->get('show_preview_information'),
);
// Set a common variable used for #states on the following elements.
$preview_checked = array(
'visible' => array(
':input[name="show_preview_information"]' => array('checked' => TRUE),
),
);
$form['live_preview']['show_sql_query_where'] = array(
'#type' => 'radios',
'#title' => t('Statistics location'),
'#options' => array(
'above' => t('Above the preview'),
'below' => t('Below the preview'),
),
'#default_value' => $config->get('show_sql_query_where'),
'#states' => $preview_checked,
);
$form['live_preview']['show_sql_query'] = array(
'#type' => 'checkbox',
'#title' => t('Show the SQL query'),
'#default_value' => $config->get('show_sql_query'),
'#states' => $preview_checked,
);
$form['live_preview']['show_performance_statistics'] = array(
'#type' => 'checkbox',
'#title' => t('Show performance statistics'),
'#default_value' => $config->get('show_performance_statistics'),
'#states' => $preview_checked,
);
$form['live_preview']['show_additional_queries'] = array(
'#type' => 'checkbox',
'#title' => t('Show other queries run during render during live preview'),
'#description' => t("Backdrop 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' => config_get('views.settings', 'show_additional_queries'),
'#states' => array(
'visible' => array(
':input[name="show_preview_information"]' => array('checked' => TRUE),
),
),
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
return $form;
}