diff --git a/core/modules/taxonomy/config/taxonomy.settings.yml b/core/modules/taxonomy/config/taxonomy.settings.yml new file mode 100644 index 0000000..cd43cc6 --- /dev/null +++ b/core/modules/taxonomy/config/taxonomy.settings.yml @@ -0,0 +1,2 @@ +override_selector: false +terms_per_page_count: 100 diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php index f81b9e5..d3e57ae 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php @@ -64,10 +64,10 @@ public function form(array $form, array &$form_state, EntityInterface $term) { ); // taxonomy_get_tree and taxonomy_term_load_parents may contain large numbers of - // items so we check for taxonomy_override_selector before loading the + // items so we check for taxonomy.settings:override_selector before loading the // full vocabulary. Contrib modules can then intercept before // hook_form_alter to provide scalable alternatives. - if (!variable_get('taxonomy_override_selector', FALSE)) { + if (!config('taxonomy.settings')->get('override_selector')) { $parent = array_keys(taxonomy_term_load_parents($term->tid)); $children = taxonomy_get_tree($vocabulary->vid, $term->tid); diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index 3847ebf..49e1e85 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -151,7 +151,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) { $form['#parent_fields'] = FALSE; $page = isset($_GET['page']) ? $_GET['page'] : 0; - $page_increment = variable_get('taxonomy_terms_per_page_admin', 100); // Number of terms per page. + $page_increment = config('taxonomy.settings')->get('terms_per_page_count'); $page_entries = 0; // Elements shown on this page. $before_entries = 0; // Elements at the root level before this page. $after_entries = 0; // Elements at the root level after this page. diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index 25d2c06..5536c3f 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -9,9 +9,11 @@ * Implements hook_uninstall(). */ function taxonomy_uninstall() { - // Remove variables. - variable_del('taxonomy_override_selector'); - variable_del('taxonomy_terms_per_page_admin'); + // Clear settings. + config('taxonomy.settings') + ->clear('override_selector') + ->clear('terms_per_page_count'); + // Remove taxonomy_term bundles. $vocabularies = db_query("SELECT machine_name FROM {taxonomy_vocabulary}")->fetchCol(); foreach ($vocabularies as $vocabulary) { @@ -349,3 +351,14 @@ function taxonomy_update_8003(&$sandbox) { $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); } + +/** + * Moves taxonomy settings from variable to config. + */ +function taxonomy_update_8004() { + update_variables_to_config('taxonomy.settings', array( + 'taxonomy_override_selector' => 'override_selector', + 'taxonomy_terms_per_page_admin' => 'terms_per_page_count', + )); +} +