public BookSettingsForm::buildForm(array $form, FormStateInterface $form_state)
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- core/modules/book/src/Form/BookSettingsForm.php, line 30
Class
- BookSettingsForm
- Configure book settings for this site.
Namespace
Drupal\book\Form
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public function buildForm( array $form , FormStateInterface $form_state ) { $types = node_type_get_names(); $config = $this ->config( 'book.settings' ); $form [ 'book_allowed_types' ] = array ( '#type' => 'checkboxes' , '#title' => $this ->t( 'Content types allowed in book outlines' ), '#default_value' => $config ->get( 'allowed_types' ), '#options' => $types , '#description' => $this ->t( 'Users with the %outline-perm permission can add all content types.' , array ( '%outline-perm' => $this ->t( 'Administer book outlines' ))), '#required' => TRUE, ); $form [ 'book_child_type' ] = array ( '#type' => 'radios' , '#title' => $this ->t( 'Content type for the <em>Add child page</em> link' ), '#default_value' => $config ->get( 'child_type' ), '#options' => $types , '#required' => TRUE, ); $form [ 'array_filter' ] = array ( '#type' => 'value' , '#value' => TRUE); return parent::buildForm( $form , $form_state ); } |
Please login to continue.