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