diff --git a/core/modules/node/config/node.settings.yml b/core/modules/node/config/node.settings.yml new file mode 100644 index 0000000..9562864 --- /dev/null +++ b/core/modules/node/config/node.settings.yml @@ -0,0 +1 @@ +items_per_page: '10' diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 570cb26..fa88007 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -489,7 +489,6 @@ function node_uninstall() { variable_del('node_admin_theme'); variable_del('node_cron_last'); variable_del('node_recent_block_count'); - variable_del('default_nodes_main'); } /** @@ -712,6 +711,15 @@ function node_update_8008() { } /** + * Coverts default_nodes_main variable to config. + * + * @ingroup config_upgrade + */ +function node_update_8009() { + update_variables_to_config('node.settings', array('default_nodes_main' => 'items_per_page')); +} + +/** * @} End of "addtogroup updates-7.x-to-8.x" * The next series of updates should start at 9000. */ diff --git a/core/modules/node/node.module b/core/modules/node/node.module index a09aee1..6cfd06a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2414,7 +2414,7 @@ function node_page_default() { ->orderBy('n.sticky', 'DESC') ->orderBy('n.created', 'DESC') ->extend('Drupal\Core\Database\Query\PagerSelectExtender') - ->limit(variable_get('default_nodes_main', 10)) + ->limit(config('node.settings')->get('items_per_page')) ->addTag('node_access'); $nids = $select->execute()->fetchCol(); @@ -2669,7 +2669,7 @@ function node_form_system_site_information_settings_form_alter(&$form, &$form_st $form['front_page']['default_nodes_main'] = array( '#type' => 'select', '#title' => t('Number of posts on front page'), - '#default_value' => variable_get('default_nodes_main', 10), + '#default_value' => config('node.settings')->get('items_per_page'), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#access' => (config('system.site')->get('page.front') == 'node'), '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'), @@ -2683,7 +2683,9 @@ function node_form_system_site_information_settings_form_alter(&$form, &$form_st * @see node_form_system_site_information_settings_form_alter() */ function node_form_system_site_information_settings_form_submit($form, &$form_state) { - variable_set('default_nodes_main', $form_state['values']['default_nodes_main']); + config('node.settings') + ->set('items_per_page', $form_state['values']['default_nodes_main']) + ->save(); } /** diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc index fe29aaf..375e5f4 100644 --- a/core/modules/taxonomy/taxonomy.pages.inc +++ b/core/modules/taxonomy/taxonomy.pages.inc @@ -46,7 +46,7 @@ function taxonomy_term_page(Term $term) { drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); $build['taxonomy_terms'] = taxonomy_term_view_multiple(array($term->id() => $term)); - if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) { + if ($nids = taxonomy_select_nodes($term->tid, TRUE, config('node.settings')->get('items_per_page'))) { $nodes = node_load_multiple($nids); $build['nodes'] = node_view_multiple($nodes); $build['pager'] = array(