I have created a field group with an empty tab. I would like to use custom code in a module to display something in this empty tab - it will just be a render array.

Can someone show me how this can be done or a link that might help me discover how to do this?

  • You can use hook_form_alter. – user72672 Nov 27 '19 at 12:50

Adding something like the below in hook_form_alter() works

    $group_name = 'group_some_name';
    $form['test'] = array(
      '#type' => 'container',
      'content' => array(
        '#markup' => 'test',
        '#prefix' => '<div>',
        '#suffix' => '</div>',
    $form['#group_children']['test'] = $group_name;
    $form['#fieldgroups'][$group_name]->children[] = 'test';

Seems like I had to add wrap the content in '#type' => 'container' for it to work

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.