1 views.install | views_update_1003() |
Update Views variables to use configuration files.
Related topics
File
- core/
modules/ views/ views.install, line 87 - Contains install and update functions for Views.
Code
function views_update_1003() {
$update_variables = array(
'views_exposed_filter_any_label' => 'new_any',
'views_show_additional_queries' => FALSE,
'views_sql_signature' => FALSE,
'views_devel_output' => FALSE,
'views_devel_region' => 'footer',
'views_display_extenders' => array(),
'views_field_rewrite_elements' => array(
'' => t('- Use default -'),
'0' => t('- None -'),
'div' => 'DIV',
'span' => 'SPAN',
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'p' => 'P',
'strong' => 'STRONG',
'em' => 'EM',
),
);
// Update the main views module variables.
$config = config('views.settings');
foreach ($update_variables as $name => $default) {
$value = update_variable_get($name, $default);
$name = str_replace('views_', '', $name);
$config->set($name, $value);
}
$config->save();
// 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();
}