1 book.admin.inc book_admin_settings($form, &$form_state)

Form constructor for the book settings form.

See also

book_menu()

book_admin_settings_submit()

book_admin_settings_validate()

Related topics

File

core/modules/book/book.admin.inc, line 50
Admin page callbacks for the Book module.

Code

function book_admin_settings($form, &$form_state) {
  $types = node_type_get_names();
  $config = config('book.settings');
  $form['book_allowed_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types allowed in book outlines'),
    '#default_value' => $config->get('book_allowed_types'),
    '#options' => $types,
    '#description' => t('Users with the %outline-perm permission can add all content types.', array('%outline-perm' => t('Administer book outlines'))),
    '#required' => TRUE,
  );
  $form['book_child_type'] = array(
    '#type' => 'select',
    '#title' => t('Content type for child pages'),
    '#default_value' => $config->get('book_child_type'),
    '#options' => $types,
    '#required' => TRUE,
  );
  $form['book_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Options'),
  );
  $form['book_options']['book_navigation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display default book navigation on book pages'),
    '#default_value' => $config->get('book_navigation'),
  );
  $form['book_options']['book_navigation_options'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select book navigation options'),
    '#default_value' => $config->get('book_navigation_options'),
    '#options' => array(
      'tree' => t('Table of contents'),
      'pager' => t('Previous, Next, and Up links'),
    ),
    '#states' => array(
      'invisible' => array(
        ':input[name="book_navigation"]' => array('checked' => FALSE),
      ),
    ),
  );
  $form['book_options']['book_links'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select book links options'),
    '#default_value' => $config->get('book_links'),
    '#options' => array(
      'book_add_child' => t('Add child page'),
      'book_reorder' => t('Reorder book'),
    ),
  );
  $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
  $form['#validate'][] = 'book_admin_settings_validate';

  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration')
  );
  return $form;
}