Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestGroupVerticalTabsForm.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 'vertical_tabs'.
10  *
11  * @internal
12  */
13 class FormTestGroupVerticalTabsForm extends FormBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function getFormId() {
19     return 'form_test_group_vertical_tabs';
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildForm(array $form, FormStateInterface $form_state) {
26     $form['vertical_tabs'] = [
27       '#type' => 'vertical_tabs',
28     ];
29     $form['meta'] = [
30       '#type' => 'details',
31       '#title' => 'First group element',
32       '#group' => 'vertical_tabs',
33     ];
34     $form['meta']['element'] = [
35       '#type' => 'textfield',
36       '#title' => 'First nested element in details element',
37     ];
38     $form['meta_2'] = [
39       '#type' => 'details',
40       '#title' => 'Second group element',
41       '#group' => 'vertical_tabs',
42     ];
43     $form['meta_2']['element_2'] = [
44       '#type' => 'textfield',
45       '#title' => 'Second nested element in details element',
46     ];
47     return $form;
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function submitForm(array &$form, FormStateInterface $form_state) {
54   }
55
56 }