Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestGroupDetailsForm.php
1 <?php
2
3 namespace Drupal\form_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Builds a simple form to test the #group property on #type 'details'.
10  */
11 class FormTestGroupDetailsForm extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'form_test_group_details';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state, $required = FALSE) {
24     $form['details'] = [
25       '#type' => 'details',
26       '#title' => 'Root element',
27       '#open' => TRUE,
28       '#required' => !empty($required),
29     ];
30     $form['meta'] = [
31       '#type' => 'details',
32       '#title' => 'Group element',
33       '#open' => TRUE,
34       '#group' => 'details',
35     ];
36     $form['meta']['element'] = [
37       '#type' => 'textfield',
38       '#title' => 'Nest in details element',
39     ];
40     return $form;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function submitForm(array &$form, FormStateInterface $form_state) {
47   }
48
49 }