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'.
11 class FormTestGroupFieldsetForm extends FormBase {
16 public function getFormId() {
17 return 'form_test_group_fieldset';
23 public function buildForm(array $form, FormStateInterface $form_state, $required = FALSE) {
25 '#type' => 'fieldset',
26 '#title' => 'Fieldset',
27 '#required' => !empty($required),
30 '#type' => 'container',
31 '#title' => 'Group element',
32 '#group' => 'fieldset',
34 $form['meta']['element'] = [
35 '#type' => 'textfield',
36 '#title' => 'Nest in container element',
44 public function submitForm(array &$form, FormStateInterface $form_state) {