Skip to content

Commit

Permalink
Issue backdrop#40: Separating Views and Views UI into separate direct…
Browse files Browse the repository at this point in the history
…ories so they can manage their config directories separately.
  • Loading branch information
quicksketch committed Dec 24, 2013
1 parent 6464d91 commit f548e07
Show file tree
Hide file tree
Showing 40 changed files with 162 additions and 124 deletions.
27 changes: 27 additions & 0 deletions core/modules/views/config/views.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"_config_name": "views.settings",
"no_javascript": false,
"exposed_filter_any_label": false,
"show_additional_queries": false,
"sql_signature": false,
"devel_output": false,
"devel_region": "footer",
"display_extenders": [

],
"field_rewrite_elements": {
"": "- Use default -",
"0": "- None -",
"div": "DIV",
"span": "SPAN",
"h1": "H1",
"h2": "H2",
"h3": "H3",
"h4": "H4",
"h5": "H5",
"h6": "H6",
"p": "P",
"strong": "STRONG",
"em": "EM"
}
}
5 changes: 0 additions & 5 deletions core/modules/views/css/views-rtl.css

This file was deleted.

2 changes: 1 addition & 1 deletion core/modules/views/handlers/views_handler_field.inc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class views_handler_field extends views_handler {
function get_elements() {
static $elements = NULL;
if (!isset($elements)) {
$elements = config_get('views', 'field_rewrite_elements');
$elements = config_get('views.settings', 'field_rewrite_elements');
}

return $elements;
Expand Down
4 changes: 2 additions & 2 deletions core/modules/views/handlers/views_handler_filter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ class views_handler_filter extends views_handler {
if (!empty($this->options['group_info']['optional']) && !$this->multiple_exposed_input()) {

$old_any = $this->options['group_info']['widget'] == 'select' ? '<Any>' : '&lt;Any&gt;';
$any_label = config_get('views', 'exposed_filter_any_label') == 'old_any' ? $old_any : t('- Any -');
$any_label = config_get('views.settings', 'exposed_filter_any_label') == 'old_any' ? $old_any : t('- Any -');
$groups = array('All' => $any_label);
}
foreach ($this->options['group_info']['group_items'] as $id => $group) {
Expand Down Expand Up @@ -1087,7 +1087,7 @@ class views_handler_filter extends views_handler {
}

if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
$any_label = config_get('views', 'exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -');
$any_label = config_get('views.settings', 'exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -');
$form['#options'] = array('All' => $any_label) + $form['#options'];
$form['#default_value'] = 'All';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class views_handler_filter_boolean_operator extends views_handler_filter {
}
// If we're configuring an exposed filter, add an <Any> option.
if (empty($form_state['exposed']) || empty($this->options['expose']['required'])) {
$any_label = config_get('views', 'exposed_filter_any_label') == 'old_any' ? '<Any>' : t('- Any -');
$any_label = config_get('views.settings', 'exposed_filter_any_label') == 'old_any' ? '<Any>' : t('- Any -');
if ($form['value']['#type'] != 'select') {
$any_label = check_plain($any_label);
}
Expand Down
Binary file removed core/modules/views/images/arrow-active.png
Binary file not shown.
Binary file removed core/modules/views/images/expanded-options.png
Binary file not shown.
Binary file removed core/modules/views/images/overridden.gif
Binary file not shown.
Binary file removed core/modules/views/images/status-active.gif
Binary file not shown.
4 changes: 2 additions & 2 deletions core/modules/views/includes/plugins.inc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function views_views_plugins() {
'use pager' => TRUE,
'accept attachments' => FALSE,
'admin' => t('Embed'),
'no ui' => !config_get('views_ui', 'display_embed'),
'no ui' => !config_get('views_ui.settings', 'display_embed'),
),
),
'display_extender' => array(
Expand Down Expand Up @@ -550,7 +550,7 @@ class views_plugin extends views_object {
* Get enabled display extenders.
*/
function views_get_enabled_display_extenders() {
$enabled = array_filter(config_get('views', 'display_extenders'));
$enabled = array_filter(config_get('views.settings', 'display_extenders'));
$options = views_fetch_plugin_names('display_extender');
foreach ($options as $name => $plugin) {
$enabled[$name] = $name;
Expand Down
6 changes: 3 additions & 3 deletions core/modules/views/includes/view.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ class view {
$exposed_form->query();
}

if (config_get('views', 'sql_signature')) {
if (config_get('views.settings', 'sql_signature')) {
$this->query->add_signature($this);
}

Expand Down Expand Up @@ -1208,7 +1208,7 @@ class view {
drupal_theme_initialize();

$start = microtime(TRUE);
if (!empty($this->live_preview) && config_get('views', 'show_additional_queries')) {
if (!empty($this->live_preview) && config_get('views.settings', 'show_additional_queries')) {
$this->start_query_capture();
}

Expand Down Expand Up @@ -1298,7 +1298,7 @@ class view {
$function($this, $this->display_handler->output, $cache);
}

if (!empty($this->live_preview) && config_get('views', 'show_additional_queries')) {
if (!empty($this->live_preview) && config_get('views.settings', 'show_additional_queries')) {
$this->end_query_capture();
}

Expand Down
37 changes: 7 additions & 30 deletions core/modules/views/views.install
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,6 @@ function views_update_8002() {
* Update Views variables to use configuration files.
*/
function views_update_8003() {
$update_ui_variables = array(
'views_ui_show_master_display' => FALSE,
'views_ui_show_sql_query' => FALSE,
'views_ui_show_preview_information' => FALSE,
'views_ui_show_sql_query_where' => 'above',
'views_ui_show_performance_statistics' => FALSE,
'views_ui_always_live_preview' => TRUE,
'views_ui_display_embed' => FALSE,
'views_ui_custom_theme' => '_default',
);
$update_variables = array(
'views_no_javascript' => FALSE,
'views_exposed_filter_any_label' => 'new_any',
Expand All @@ -168,24 +158,6 @@ function views_update_8003() {
'em' => 'EM',
),
);
$delete_variables = array(
'views_ui_show_listing_filters',
'views_skip_cache',
);

// Update the UI variables.
$config = config('views_ui.settings');
$current_ui_variables = db_select('variable')
->fields('variable')
->condition('name', array_keys($update_ui_variables), 'IN')
->execute()
->fetchAllAssoc('name');
$current_ui_variables = array_map('unserialize', $current_ui_variables);
foreach ($update_ui_variables as $name => $default) {
$value = isset($current_ui_variables[$name]) ? $current_ui_variables[$name] : $default;
$config->set($name, $value);
}
$config->save();

// Update the main views module variables.
$config = config('views.settings');
Expand All @@ -196,13 +168,18 @@ function views_update_8003() {
->fetchAllAssoc('name');
$current_variables = array_map('unserialize', $current_variables);
foreach ($update_variables as $name => $default) {
$name = str_replace('views_', '', $name);
$value = isset($current_variables[$name]) ? $current_variables[$name] : $default;
$config->set($name, $value);
}
$config->save();

// Delete the removed variables.
db_delete('variable')->condition('name', $delete_variables, 'IN');
// Delete the updated and unneeded variables.
$delete_variables = array_keys($update_variables);
$delete_variables[] = 'views_skip_cache';
db_delete('variable')
->condition('name', $delete_variables, 'IN')
->execute();
}

/**
Expand Down
6 changes: 5 additions & 1 deletion core/modules/views/views.module
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ function views_theme($existing, $type, $theme, $path) {
'pattern' => 'views_more__',
'variables' => array('more_url' => NULL, 'link_text' => 'more', 'view' => NULL),
);
$hooks['views_container'] = array(
'render element' => 'element',
'file' => 'theme/theme.inc',
);

// Add theme suggestions which are part of modules.
foreach (views_get_module_apis() as $info) {
Expand Down Expand Up @@ -1144,7 +1148,7 @@ function views_add_css($file) {
*/
function views_add_js($file) {
// If javascript has been disabled by the user, never add js files.
if (config_get('views', 'no_javascript')) {
if (config_get('views.settings', 'no_javascript')) {
return;
}
static $base = TRUE, $ajax = TRUE;
Expand Down
13 changes: 0 additions & 13 deletions core/modules/views/views_ui.info

This file was deleted.

11 changes: 11 additions & 0 deletions core/modules/views/views_ui/config/views_ui.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"_config_name": "views_ui.settings",
"show_master_display": false,
"show_sql_query": false,
"show_preview_information": false,
"show_sql_query_where": false,
"show_performance_statistics": false,
"always_live_preview": false,
"display_embed": false,
"custom_theme": false
}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit f548e07

Please sign in to comment.