You are here

function paging_settings in Paging 5

Same name and namespace in other branches
  1. 6 paging.module \paging_settings()
  2. 7 paging.admin.inc \paging_settings()

Menu callback; display module settings form.

1 string reference to 'paging_settings'
paging_menu in ./paging.module
Implementation of hook_menu().

File

./paging.module, line 46

Code

function paging_settings() {
  $form = array();
  $form['paging_config'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basic preferences'),
  );
  $form['paging_config']['paging_node_types_enabled'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Node types'),
    '#description' => t('Select the node types you want to enable paging for.'),
    '#default_value' => variable_get('paging_node_types_enabled', array()),
    '#options' => node_get_types('names'),
  );
  $form['paging_config']['paging_separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Separator'),
    '#size' => 20,
    '#maxlength' => 255,
    '#default_value' => PAGING_SEPARATOR,
    '#required' => TRUE,
    '#description' => t('Page separator string. You should use an HTML tag that will render reasonably when paging is not enabled, such as <em>&lt;!--pagebreak--&gt;</em> or <em>&lt;HR /&gt;</em>.'),
  );
  $form['paging_config']['paging_read_more_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link "Read more" to the second page'),
    '#description' => t('If enabled, the "Read more" link under teasers will link to the 2nd page of the node. Implemented only when the teaser and the first page content is same.'),
    '#default_value' => variable_get('paging_read_more_enabled', 0),
  );
  $form['paging_config']['paging_pager_widget_position'] = array(
    '#type' => 'radios',
    '#title' => t('Pager position'),
    '#options' => array(
      'below' => t('Below content'),
      'above' => t('Above content'),
      'both' => t('Below and above content'),
      'manual' => t('None (No output)'),
    ),
    '#required' => TRUE,
    '#description' => t('Choose the position of page navigation. If set to %none, <code>@paging</code> can be used to place it at a customizable location.', array(
      '%none' => t('None'),
      '@paging' => '$node->paging',
    )),
    '#default_value' => variable_get('paging_pager_widget_position', 'below'),
  );
  $form['paging_automatic'] = array(
    '#type' => 'fieldset',
    '#title' => t('Automatic Paging'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Automatic paging is disabled when both methods below are disabled, or when the node already contains the page break separator. Automatic paging by line break is preferred over the method of automatic paging by words.'),
  );
  $form['paging_automatic']['paging_paragraph'] = array(
    '#type' => 'fieldset',
    '#title' => t('By line break'),
    '#collapsed' => FALSE,
    '#prefix' => '<div class="container-inline">',
  );
  $form['paging_automatic']['paging_paragraph']['paging_automatic_chars'] = array(
    '#type' => 'select',
    '#title' => t('Length of each page'),
    '#options' => array(
      0 => t('Disabled'),
      500 => t('500 characters'),
      750 => t('750 characters'),
      1000 => t('1000 characters'),
      1500 => t('1500 characters'),
      2000 => t('2000 characters'),
      2500 => t('2500 characters'),
      3000 => t('3000 characters'),
      3500 => t('3500 characters'),
      4000 => t('4000 characters'),
      4500 => t('4500 characters'),
    ),
    '#required' => TRUE,
    '#description' => '<br />' . t('Set the number of characters that should be displayed per page. <strong>This is the recommended method</strong> for automatic paging.'),
    '#default_value' => variable_get('paging_automatic_chars', 0),
  );
  $form['paging_automatic']['paging_words'] = array(
    '#type' => 'fieldset',
    '#title' => t('By words'),
    '#collapsed' => FALSE,
  );
  $form['paging_automatic']['paging_words']['paging_automatic_words'] = array(
    '#type' => 'select',
    '#title' => t('Length of each page'),
    '#options' => array(
      0 => t('Disabled'),
      100 => t('100 words'),
      150 => t('150 words'),
      200 => t('200 words'),
      250 => t('250 words'),
      300 => t('300 words'),
      350 => t('350 words'),
      400 => t('400 words'),
      450 => t('450 words'),
      500 => t('500 words'),
      550 => t('550 words'),
      600 => t('600 words'),
      650 => t('650 words'),
      700 => t('700 words'),
      750 => t('750 words'),
    ),
    '#required' => TRUE,
    '#description' => '<br />' . t('Set the number of words that should be displayed per page. This may break your sentences at page breaks.'),
    '#default_value' => variable_get('paging_automatic_words', 0),
    '#suffix' => '</div>',
  );
  return system_settings_form($form);
}