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 'fieldset'.
13 class FormTestGroupFieldsetForm extends FormBase {
18 public function getFormId() {
19 return 'form_test_group_fieldset';
25 public function buildForm(array $form, FormStateInterface $form_state, $required = FALSE) {
27 '#type' => 'fieldset',
28 '#title' => 'Fieldset',
29 '#required' => !empty($required),
32 '#type' => 'container',
33 '#title' => 'Group element',
34 '#group' => 'fieldset',
36 $form['meta']['element'] = [
37 '#type' => 'textfield',
38 '#title' => 'Nest in container element',
46 public function submitForm(array &$form, FormStateInterface $form_state) {