Hi,

i want to use vertical tabs in a configuration form, i get my tabs in groups, but they are not shown in a sexy tab menu, only a groups together.
So i need some help or the right words i have to search for.

$form['advanced'] = array(
            '#type' => 'vertical_tabs',
            '#title' => t('Settings'),
        );
        $form['base'] = array(
            '#type' => 'fieldset',
            '#title' => t('Base Settings'),
            '#group' => 'advanced',
        );
        $form['base']['basePath'] = array(
            '#type' => 'textfield',
            '#value' => $this->config->get('basePath'),
            '#required' =>TRUE,
            '#title' => t('Drupal Base Path of WeatherAPI'),
        );
        
        $form['rest'] = array(
            '#type' => 'fieldset',
            '#title' => t('REST Settings'),
            '#group' => 'advanced',
        );
        $form['rest']['entityNodeGET'] = array(
            '#type' => 'textfield',
            '#value' => $this->config->get('entityNodeGET'),
            '#required' =>TRUE,
            '#title' => t('Drupal Base Path of GET'),
        );
        $form['database'] = array(
            '#type' => 'fieldset',
            '#title' => t('Database Settings'),
            '#group' => 'advanced',
        );
        $form['database']['databaseHost']= array(
            '#type' => 'textfield',
            '#value' => $this->config->get('databaseHost'),
            '#required' =>TRUE,
            '#title' => t('Database HOST'),
        );
        
        $form['dwd'] = array(
            '#type' => 'fieldset',
            '#title' => t('DWD Settings'),
            '#group' => 'advanced',
        );
        $form['dwd']['DWDNode'] = [
            '#type' => 'textfield',
            '#value' => $this->config->get('DWDNode'),
            '#required' =>TRUE,
            '#title' => t('DWD Node ID'),
        ];
        $form['submit'] = [
            '#type' => 'submit',
            '#value' => t('Save'),
        ];
        return $form; 

Thanks a lot
Andy

Comments

jjcarrion’s picture

Hi Andy,

Instead of 'fieldset' you need to use 'details'. It would be something like this:

$form['base'] = array(
  '#type' => 'details',
  '#title' => t('Base Settings'),
  '#group' => 'advanced',
);

And so on with the rest...

AndyLicht’s picture

Thanks a lot, now everything looks "sexy".

kienan91’s picture

Thank you