3 namespace Drupal\form_test\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Builds a simple form to test the #group property on #type 'details'.
11 class FormTestGroupDetailsForm extends FormBase {
16 public function getFormId() {
17 return 'form_test_group_details';
23 public function buildForm(array $form, FormStateInterface $form_state, $required = FALSE) {
26 '#title' => 'Root element',
28 '#required' => !empty($required),
32 '#title' => 'Group element',
34 '#group' => 'details',
36 $form['meta']['element'] = [
37 '#type' => 'textfield',
38 '#title' => 'Nest in details element',
46 public function submitForm(array &$form, FormStateInterface $form_state) {