Commit 451bf657 authored by webchick's avatar webchick

Issue #2401035 by alexpott: items_per_page in node.settings is no longer used

parent bb7adebe
......@@ -6,10 +6,8 @@ source:
plugin: variable
variables:
- node_admin_theme
- default_nodes_main
process:
use_admin_theme: node_admin_theme
items_per_page: default_nodes_main
destination:
plugin: config
config_name: node.settings
......@@ -25,10 +25,6 @@ public function load() {
'name' => 'node_admin_theme',
'value' => 'i:0;',
))
->values(array(
'name' => 'default_nodes_main',
'value' => 's:1:"3";',
))
->execute();
}
}
......@@ -48,7 +48,6 @@ protected function setUp() {
public function testNodeSettings() {
$config = $this->config('node.settings');
$this->assertIdentical($config->get('use_admin_theme'), FALSE);
$this->assertIdentical($config->get('items_per_page'), 3);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'node.settings', $config->get());
}
......
......@@ -4,9 +4,6 @@ node.settings:
type: mapping
label: 'Node settings'
mapping:
items_per_page:
type: integer
label: 'Number of posts on front page'
use_admin_theme:
type: boolean
label: 'Use admin theme when editing or creating content'
......
......@@ -830,39 +830,6 @@ function node_page_top(array &$page) {
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Alters the System module's site information settings form to add a global
* default setting for number of posts to show on node listing pages.
*
* @see node_page_default()
* @see node_form_system_site_information_settings_form_submit()
*/
function node_form_system_site_information_settings_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30);
$form['front_page']['default_nodes_main'] = array(
'#type' => 'select',
'#title' => t('Number of posts on front page'),
'#default_value' => \Drupal::config('node.settings')->get('items_per_page'),
'#options' => array_combine($options, $options),
'#access' => (\Drupal::config('system.site')->get('page.front') == 'node'),
'#description' => t('The maximum number of posts displayed on overview pages such as the front page.'),
);
$form['#submit'][] = 'node_form_system_site_information_settings_form_submit';
}
/**
* Form submission handler for system_site_information_settings().
*
* @see node_form_system_site_information_settings_form_alter()
*/
function node_form_system_site_information_settings_form_submit($form, FormStateInterface $form_state) {
\Drupal::config('node.settings')
->set('items_per_page', $form_state->getValue('default_nodes_main'))
->save();
}
/**
* Implements hook_form_FORM_ID_alter().
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment