Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This doesn't work:
// Build hooks list
$form['hooks'] = array(
'#title' => t('Use the following specific hooks'),
'#tree' => TRUE,
);
$form['hooks_tabs'] = array(
'#type' => 'vertical_tabs',
);
foreach ($hook_groups as $hook_group => $hooks) {
$form['hooks'][$hook_group] = array(
'#type' => 'fieldset',
'#title' => $hook_group . ' hooks',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
//'#theme' => 'module_builder_hook_list',
'#tree' => TRUE,
'#group' => 'hooks_tabs',
);
// ... etc
The problem is that the fieldset to be put as a vertical tab is at $form['hooks']['foo']. If I change it to $form['foo'] then it works.
Comments
Comment #4
aspilicious CreditAttribution: aspilicious commentedHmm, maybe this is by design... Interested why it doesn't work...
Comment #11
lauriiiThe vertical tabs render element only works if the render element belonging to a group are specified on the same level as the vertical tabs itself. I think we can close this issue now since it seems like we have made some improvements to the documentation since the opening of this issue (Drupal 7 documentation).
Essentially your code would have to become: