b37d6bba44b45bd91420a0ef565e457f0511b0a2
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestGroupFieldsetForm.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 'fieldset'.
10  *
11  * @internal
12  */
13 class FormTestGroupFieldsetForm extends FormBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function getFormId() {
19     return 'form_test_group_fieldset';
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildForm(array $form, FormStateInterface $form_state, $required = FALSE) {
26     $form['fieldset'] = [
27       '#type' => 'fieldset',
28       '#title' => 'Fieldset',
29       '#required' => !empty($required),
30     ];
31     $form['meta'] = [
32       '#type' => 'container',
33       '#title' => 'Group element',
34       '#group' => 'fieldset',
35     ];
36     $form['meta']['element'] = [
37       '#type' => 'textfield',
38       '#title' => 'Nest in container element',
39     ];
40     return $form;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function submitForm(array &$form, FormStateInterface $form_state) {
47   }
48
49 }