diff --git a/handlers/views_handler_filter.inc b/handlers/views_handler_filter.inc index 90e6b73b0b39840e0a8d8c45c0de21041262cbbc..24f28a360dfbb62d8b9a0cd07b5c3580d5efbc46 100644 --- a/handlers/views_handler_filter.inc +++ b/handlers/views_handler_filter.inc @@ -512,7 +512,7 @@ function exposed_translate(&$form, $type) { } if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) { - $any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? t('<Any>') : t('- Any -'); + $any_label = config('views.settings')->get('views_exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -'); $form['#options'] = array('All' => $any_label) + $form['#options']; $form['#default_value'] = 'All'; } diff --git a/handlers/views_handler_filter_boolean_operator.inc b/handlers/views_handler_filter_boolean_operator.inc index a5fd8f0d94b6eaeebb6ebb0d17f25ee82361f74b..ea967871ede7a528abfbbc72a0e1ae8eea6207fc 100644 --- a/handlers/views_handler_filter_boolean_operator.inc +++ b/handlers/views_handler_filter_boolean_operator.inc @@ -113,7 +113,7 @@ function value_form(&$form, &$form_state) { } // If we're configuring an exposed filter, add an <Any> option. if (empty($form_state['exposed']) || empty($this->options['expose']['required'])) { - $any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? '<Any>' : t('- Any -'); + $any_label = config('views.settings')->get('views_exposed_filter_any_label') == 'old_any' ? '<Any>' : t('- Any -'); if ($form['value']['#type'] != 'select') { $any_label = check_plain($any_label); } diff --git a/includes/admin.inc b/includes/admin.inc index 99b58ba4f15257275992442f4dd21f78c240e0aa..4add87a1abbcb9582dffa13d4460e5f81f0b1182 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -85,7 +85,7 @@ function views_ui_add_admin_css() { * be useful. */ function views_ui_check_advanced_help() { - if (!variable_get('views_ui_show_advanced_help_warning', TRUE)) { + if (!config('views.settings')->get('views_ui_show_advanced_help_warning')) { return; } @@ -115,13 +115,14 @@ function views_ui_preview($view, $display_id, $args = array()) { $old_q = current_path(); // Determine where the query and performance statistics should be output. - $show_query = variable_get('views_ui_show_sql_query', FALSE); - $show_info = variable_get('views_ui_show_preview_information', FALSE); - $show_location = variable_get('views_ui_show_sql_query_where', 'above'); + $config = config('views.settings'); + $show_query = $config->get('views_ui_show_sql_query'); + $show_info = $config->get('views_ui_show_preview_information'); + $show_location = $config->get('views_ui_show_sql_query_where'); - $show_stats = variable_get('views_ui_show_performance_statistics', FALSE); + $show_stats = $config->get('views_ui_show_performance_statistics'); if ($show_stats) { - $show_stats = variable_get('views_ui_show_sql_query_where', 'above'); + $show_stats = $config->get('views_ui_show_sql_query_where'); } $combined = $show_query && $show_stats; @@ -1508,7 +1509,7 @@ function views_ui_edit_page_display_tabs($view, $display_id = NULL) { */ function views_ui_show_default_display($view) { // Always show the default display for advanced users who prefer that mode. - $advanced_mode = variable_get('views_ui_show_master_display', FALSE); + $advanced_mode = config('views.settings')->get('views_ui_show_master_display'); // For other users, show the default display only if there are no others, and // hide it if there's at least one "real" display. $additional_displays = (count($view->display) == 1); @@ -1687,7 +1688,7 @@ function views_ui_get_display_tab_details($view, $display) { // recollapse the column. $build['columns']['third']['#attributes']['id'] = 'views-ui-advanced-column-' . $view->name; // Collapse the div by default. - if (!variable_get('views_ui_show_advanced_column', FALSE)) { + if (!config('views.settings')->get('views_ui_show_advanced_column')) { $build['columns']['third']['#attributes']['class'][] = 'ctools-collapsed'; } $build['columns']['third']['advanced'] = array('#markup' => '<h3 class="ctools-collapsible-handle"><a href="">' . t('Advanced') . '</a></h3>',); @@ -4744,7 +4745,7 @@ function views_ui_admin_settings_basic() { // $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), +// '#default_value' => $config->get('views_ui_always_live_preview_button'), // ); $form['live_preview']['views_ui_show_preview_information'] = array( @@ -4818,10 +4819,10 @@ function views_ui_admin_settings_basic() { } /** -+ * Form builder submit handler; Handle submission the basic views settings. -+ * @ingroup forms -+ * @see system_settings_form() -+ */ + * Form builder submit handler; Handle submission the basic views settings. + * @ingroup forms + * @see system_settings_form() + */ function views_ui_admin_settings_basic_submit(&$form, &$form_state) { config('views.settings') ->set('views_ui_show_listing_filters', $form_state['values']['views_ui_show_listing_filters']) diff --git a/includes/cache.inc b/includes/cache.inc index c38e0435872544d4c5b78c5a9c3dae2fe07db5e5..f7f8a1c17dd5a059f3067c03c295d54b9a80c051 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -128,7 +128,7 @@ function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) * If TRUE, the data will be cached specific to the currently active language. */ function views_cache_set($cid, $data, $use_language = FALSE) { - if (variable_get('views_skip_cache', FALSE)) { + if (config('views.settings')->get('views_skip_cache')) { return; } if ($use_language) { @@ -152,7 +152,7 @@ function views_cache_set($cid, $data, $use_language = FALSE) { * The cache or FALSE on failure. */ function views_cache_get($cid, $use_language = FALSE) { - if (variable_get('views_skip_cache', FALSE)) { + if (config('views.settings')->get('views_skip_cache')) { return FALSE; } if ($use_language) { diff --git a/includes/plugins.inc b/includes/plugins.inc index cb6c7e448602215eec0294b373a19cb0992f6fd2..7cb03fe3af200c2e30236cdcd0fd65d8473473de 100644 --- a/includes/plugins.inc +++ b/includes/plugins.inc @@ -93,7 +93,7 @@ function views_views_plugins() { 'use pager' => TRUE, 'accept attachments' => FALSE, 'admin' => t('Embed'), - 'no ui' => !variable_get('views_ui_display_embed', FALSE), + 'no ui' => !config('views.settings')->get('views_ui_display_embed'), ), ), 'display_extender' => array( diff --git a/includes/view.inc b/includes/view.inc index b3a9921849e4f4413a6d17930758f986463190e6..604f9560fea0e6085bf9a6fb0fb4267af3219b95 100644 --- a/includes/view.inc +++ b/includes/view.inc @@ -1027,7 +1027,7 @@ function build($display_id = NULL) { $exposed_form->query(); } - if (variable_get('views_sql_signature', FALSE)) { + if (config('views.settings')->get('views_sql_signature')) { $this->query->add_signature($this); } @@ -1168,9 +1168,10 @@ function render($display_id = NULL) { } drupal_theme_initialize(); + $config = config('views.settings'); $start = microtime(TRUE); - if (!empty($this->live_preview) && variable_get('views_show_additional_queries', FALSE)) { + if (!empty($this->live_preview) && $config->get('views_show_additional_queries')) { $this->start_query_capture(); } @@ -1259,7 +1260,7 @@ function render($display_id = NULL) { $function($this, $this->display_handler->output, $cache); } - if (!empty($this->live_preview) && variable_get('views_show_additional_queries', FALSE)) { + if (!empty($this->live_preview) && $config->get('views_show_additional_queries')) { $this->end_query_capture(); } $this->render_time = microtime(TRUE) - $start; diff --git a/plugins/export_ui/views_ui.class.php b/plugins/export_ui/views_ui.class.php index 6235b01b219d5307d2dc5bb9e952207060830288..c5c4001f887c9ca3d2c83c251a6de4a4ff2f84b8 100644 --- a/plugins/export_ui/views_ui.class.php +++ b/plugins/export_ui/views_ui.class.php @@ -69,7 +69,7 @@ function load_item($item_name) { function list_form(&$form, &$form_state) { $row_class = 'container-inline'; - if (!variable_get('views_ui_show_listing_filters', FALSE)) { + if (!config('views.settings')->get('views_ui_show_listing_filters')) { $row_class .= " element-invisible"; } diff --git a/tests/views_translatable.test b/tests/views_translatable.test index 0cb27e4004cb7ec07b43f76095de39db2bc65c04..f3454cf7aa14c773f0ec9be5c10e98544192e4ef 100644 --- a/tests/views_translatable.test +++ b/tests/views_translatable.test @@ -40,7 +40,7 @@ class ViewsTranslatableTest extends ViewsSqlTest { public function setUp() { parent::setUp(); - variable_set('views_localization_plugin', 'test'); + config('views.settings')->set('views_localization_plugin', 'test')->save(); // Reset the plugin data. views_fetch_plugin_data(NULL, NULL, TRUE); $this->strings = array('Master1', 'Apply1', 'Sort By1', 'Asc1', 'Desc1', 'more1', 'Reset1', 'Offset1', 'Master1', 'title1', 'Items per page1', 'fieldlabel1', 'filterlabel1'); diff --git a/views.module b/views.module index 9ad9e24697d4a3461486fc49bc0afdfbbae776f9..b039ccc3151f8c0f5ee11356318ef0b91b71ee4f 100644 --- a/views.module +++ b/views.module @@ -1052,7 +1052,7 @@ function views_add_css($file) { */ function views_add_js($file) { // If javascript has been disabled by the user, never add js files. - if (variable_get('views_no_javascript', FALSE)) { + if (config('views.settings')->get('views_no_javascript')) { return; } static $base = TRUE, $ajax = TRUE; @@ -1606,8 +1606,9 @@ function views_debug($message, $placeholders = array()) { if (!is_string($message)) { $output = '<pre>' . var_export($message, TRUE) . '</pre>'; } - if (module_exists('devel') && variable_get('views_devel_output', FALSE) && user_access('access devel information')) { - $devel_region = variable_get('views_devel_region', 'footer'); + $config = config('views.settings'); + if (module_exists('devel') && $config->get('views_devel_output') && user_access('access devel information')) { + $devel_region = $config->get('views_devel_region'); if ($devel_region == 'watchdog') { $output = $message; watchdog('views_logging', $output, $placeholders); diff --git a/views_ui.module b/views_ui.module index 1a6f454099012e15fe13697150977eba69c6ed08..d96b292c2e77d59f5ddb0c9cecc854ed5bf54168 100644 --- a/views_ui.module +++ b/views_ui.module @@ -231,7 +231,7 @@ function views_ui_theme() { * Impements hook_custom_theme() */ function views_ui_custom_theme() { - $theme = variable_get('views_ui_custom_theme', '_default'); + $theme = config('views.settings')->get('views_ui_custom_theme'); if ($theme != '_default') { $available = list_themes();