0

Is there a way to add fieldsets inside of a custom composite? Not looking to add anything repeatable, just simply group the fields together.

This get's the fieldset to show but I don't know how to add fields as children.

$elements['grouped_fields'] = [
  '#type' => 'fieldset',
  '#title' => t('Grouped Fields')
];
0

Place the fields inside of the fieldset:

$elements['grouped_fields']['field1'] = [
  '#type' => 'textfield',
  '#title' => t('Field 1'),
];
$elements['grouped_fields']['field2'] = [
  '#type' => 'textfield',
  '#title' => t('Field 2'),
];
// ...
  • Boom! You rock. – Brad O Feb 11 '18 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.