function node_form_system_site_information_settings_form_alter

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 also

node_page_default()

taxonomy_term_page()

node_form_system_site_information_settings_form_submit()

File

drupal/core/modules/node/node.module, line 2385
The core module that allows content to be submitted to the site.

Code

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' => 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.'),
  );
  $form['#submit'][] = 'node_form_system_site_information_settings_form_submit';
}