public function BookSettingsForm::buildForm

Implements \Drupal\Core\Form\FormInterface::buildForm().

Overrides SystemConfigFormBase::buildForm

File

drupal/core/modules/book/lib/Drupal/book/BookSettingsForm.php, line 27
Contains \Drupal\book\BookSettingsForm.

Class

BookSettingsForm
Configure book settings for this site.

Namespace

Drupal\book

Code

public function buildForm(array $form, array &$form_state) {
  $types = node_type_get_names();
  $config = $this->configFactory
    ->get('book.settings');
  $form['book_allowed_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types allowed in book outlines'),
    '#default_value' => $config
      ->get('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' => 'radios',
    '#title' => t('Content type for child pages'),
    '#default_value' => $config
      ->get('child_type'),
    '#options' => $types,
    '#required' => TRUE,
  );
  $form['array_filter'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  return parent::buildForm($form, $form_state);
}