Commit 517ef082 authored by webchick's avatar webchick

Issue #1666074 by sun: Move 'default_nodes_main()' setting to node module.

parent 15f322b7
......@@ -2765,6 +2765,37 @@ function node_search_validate($form, &$form_state) {
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Alters 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 taxonomy_term_page()
* @see node_form_system_site_information_settings_form_submit()
*/
function node_form_system_site_information_settings_form_alter(&$form, &$form_state, $form_id) {
$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),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#access' => (variable_get('site_frontpage') == '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, &$form_state) {
variable_set('default_nodes_main', $form_state['values']['default_nodes_main']);
}
/**
* Implements hook_form_FORM_ID_alter().
*
......
......@@ -1501,13 +1501,6 @@ function system_site_information_settings() {
'#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'),
'#field_prefix' => url(NULL, array('absolute' => TRUE)),
);
$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),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('The maximum number of posts displayed on overview pages such as the front page.'),
'#access' => (variable_get('site_frontpage') == 'node'),
);
$form['error_page'] = array(
'#type' => 'fieldset',
'#title' => t('Error pages'),
......
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