There is the module for Drupal 6 "Vertical Tabs". And we can enable or disable it.
In Drupal 7 it is a core function, and I can not find anywhere in UI how to disable it.

And what I have to do if I just don't want to see vertical tabs in forms?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Needs work » Closed (works as designed)

Correct. There is no customization for it in D7 by design. Likely it would be provided by the vertical tabs module ported to D7.

Dripman’s picture

Ok how can I disable vertical tabs functionality for now?

May be there is a function that i can add in my theme to disable it?

May be drupal_disable_tabs(); ?

or

function theme_name_tabs () {.............. return $result;}?

Dripman’s picture

Title: Vertical tabs cannot be disabled » Vertical Tabs issue in Drupal 7
Category: feature » bug
Status: Active » Closed (works as designed)

Solution was found:

template.php :

// Disable vertical tabs
function replace_array_values_vertical_tabs_to_fieldsets(&$item, $key) {

	// Search for 'vertical_tabs' values with key '#type' and replace to 'fieldset'
	if ($item == 'vertical_tabs' && $key == '#type') {
		$item = 'fieldset';
	}
}

// Implements hook_form_alter
function mytheme_form_alter(&$form, &$form_state, $form_id) {

	// Go through hole array using 'replace_array_values_vertical_tabs_to_fieldsets' function
	array_walk_recursive($form, 'replace_array_values_vertical_tabs_to_fieldsets');
}
entrigan’s picture

Title: Vertical Tabs issue in Drupal 7 » Vertical tabs cannot be disabled
Category: bug » feature
Status: Closed (works as designed) » Active

Changing to feature request, setting active. There are plenty of cases where vertical tabs are undesirable.

Dripman’s picture

Dripman’s picture

Title: Vertical Tabs issue in Drupal 7 » Vertical tabs cannot be disabled
Category: bug » feature
Status: Closed (works as designed) » Active
Issue tags: +disable, +vertical tabs, +verticaltabs, +vertical_tabs
FileSize
905 bytes

Or here:

goldlilys’s picture

FileSize
47.33 KB

Actually can you have an option to disable vertical tabs for authenticated users only?

I want vertical tabs to be enabled for admins.

Since normal users don't get all the other options which needs vertical tabs, some fields are being displayed incorrectly (pushed to the right side as if there's a virtual tab on the left) when they add or edit new nodes.

deggertsen’s picture

Subscribe. I would simply like a way to decide which fieldsets show up in the vertical tabs. Maybe there is already a way to do this but I haven't found one yet. I know with the Verticle Tabs module in D6 this option was available when editing content types.

marcingy’s picture

Version: 7.0 » 8.x-dev

Features are added in head first

Everett Zufelt’s picture

Status: Active » Closed (works as designed)

For comment #7, if there are places where v-tabs are not displaying correctly then please file a bug against the CSS component for that issue.

#4 pleasae provide use-cases.

HnLn’s picture

Use cases:
* I want to be able to order / group items that belong together (publishing and authored by, menu settings and pathauto, ...).
* I just don't like the ui of vertical tabs and prefer them in a left column (e.g. nodeformcols or panel forms or ds forms).

Good news: with http://drupal.org/project/rel field_group can turn the vertical tabs in e.g. fieldsets.

jcassano’s picture

I don't think this should be marked "works as designed". Vertical tabs don't make sense (and look extremely awkward) if a user only has permission to edit the data contained within one vertical tab. Why use vertical tabs when there's only one vertical tab? e.g. http://i.imgur.com/iLHv9.png

deggertsen’s picture

Priority: Normal » Minor
Status: Closed (works as designed) » Active

I agree. This should not be "works as designed" as there are use cases where you may not want vertical tabs. If this is a "wont fix" item that's different, but seeing as there are people who want this feature I believe it should be an active issue.

If someone can explain a way to disable them then we can close this issue, but until then it should remain open. Maybe it could be marked as a lower priority item though.

vood002’s picture

The workaround in #3 worked for me.

Depending upon your needs you may need to move all of the fieldsets back out of the 'additional_options' array.

Node Form Columns was able to move the additional_options array into the sidebar.

RogerRogers’s picture

I just found that:

$form['additional_settings']['#access'] = FALSE;

has, in effect, the same result as hiding the vertical tabs. Additional_settings includes all the settings in the vertical tabs, such as path, menu, etc. This assumes that you don't want to show any of the additional settings at all, you can also hide each setting/tab individually using a similar approach, e.g. $form['path']['#access'] = FALSE;.

For completeness, here is the code I have in my template.php file (I'm using a switch to only hide for a specific content type, you can remove to apply everywhere):

function themename_form_alter(&$form, $form_state, $form_id) {

  switch ($form_id) {
    case 'node_type_node_form': // just for 'node_type', remove if you want broader      
      $form['additional_settings']['#access'] = FALSE;
    break; 
  }

}
nagiek’s picture

Thanks @RogerRogers!

adellefrank’s picture

Be sure not to allow for the forms you don't realize you are processing, too, or you might get an "Undefined index: #type" error after adding your hook_form_alter() to your template.php file.

For example, I got this error because I hadn't allowed for the basic 'search_block_form'. And, to "fix" this error, I changed the first line of my if statement to ignore that form_id (see code below).

function MYTHEMENAME_form_alter(&$form, $form_state, $form_id) {

    global $user;

    if ($form_id == 'search_block_form') {
        
    } else {
        if (in_array('anonymous user', $user->roles)) {
            $form['revision_information']['#access'] = FALSE;
        } else {
            $form['revision_information']['#access'] = TRUE;
        }
    }
}
nod_’s picture

Don't come up with crazy irrelevant tags please.

Otherwise, what #10 said.

HnLn’s picture

#18, this is not an issue about vertical tags being broken (the reply in #10) but about being able to disable the vertical tabs altogether so developers can create a nicer user experience (in my opinion vertical tabs are not very good when it comes to UX and some use cases have been provided since then, #11, #12).

brianfisher’s picture

If you want to disable a specific vertical tab

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  // node edit forms
  if (substr($form_id, -10) == '_node_form') {
    // un-tab publishing options
    unset($form['options']['#group']);
    $form['options']['#collapsible'] = FALSE;
    $form['options']['#collapsed'] = FALSE;
  }
}
aritra.ghosh’s picture

I dont know whether this issue is still open but I have created a module for this.
http://drupal.org/project/node_vertical_tab_elements

This module aims for cleaning up node edit forms but only when panels are used to override node edit forms.

This modules provides for disabling some or all of the components of node edit vertical tab components
and also rearranging them to any position in the page.

atiba’s picture

thanks a lot RogerRogers! that worked just fine!

see15_aug’s picture

On #15
I know this solution but it is not working on server. What to do?

hazit’s picture

Version: 8.x-dev » 7.22

I'm new to drupal and vertical tabs is proving one of those 'breaking points' where I'm inclined to pack the whole thing in and suffer with a stupid Wordpress site instead.

I have installed the microblog module and have the form in a block on the sidebar.

I now want to activate the Book module, but when I do that what I now know as a "vertical tab" appears in the block, and it appears impossible to switch off.

It seems this was easier to manage in Drupal 6. With Drupal 7 it seems something has been added without adequate, accessible means for novice users for managing those new 'features'.

The standard solution it seems is to instal yet more modules to solve this, which in this case seem to be Renderable Elements https://drupal.org/project/rel and Field Group https://drupal.org/project/field_group. This will likely mean yet more bloat to my instal, and more learning curve with many more hours invested in overcoming the simplest step. I'm all for learning, but in Dupal it seems to be hours and hours for the simplest tweak.

Probably these modules will turn out to be awesome, and I guess that's the way 'learning Drupal' goes, but it is frustrating to do this to solve such simple problems that appear to be engineered in as 'features' without adequate scope for novice users to adjust the settings.

Drupal has many great things, but there is still the sense that building websites like this should remain the province of professional developers - keeping them employed and everyone else excluded. Supposedly the whole Drupal idea is to make this accessible, but I am not always sure this is really borne out.

nod_’s picture

Version: 7.22 » 8.x-dev

if that is not solved on D8 we don't put it back to D7. and if you put it back to 7.x, set it to the dev version, not a fixed version.

hazit’s picture

Version: 8.x-dev » 7.22

Update re griping at #24:

Installed Renderable Elements https://drupal.org/project/rel and Field Group https://drupal.org/project/field_group.

Seemed to fix the problem in my case. You can deactivate these modules again and the fix seems to stay.

Only burned through half a day on this one :-) Now to the next problem https://drupal.org/node/87545.

nod_’s picture

Version: 7.22 » 8.x-dev
HnLn’s picture

Isn't this already fixed in d8 ? D8 is going to use a right column instead of the vertical tabs ?

jerrylow’s picture

By using

$form['additional_settings']['#access'] = FALSE;

It actually won't allow the status and options to save, instead I have to set all the tabs individually:

$form['revision_information']['#access'] = FALSE;
$form['author']['#access'] = FALSE;
$form['path']['#access'] = FALSE;
$form['options']['#access'] = FALSE;
Sk8erPeter’s picture

Issue tags: -JavaScript

There's a much simpler way to disable vertical tabs on a form, by simply changing the $form['additional_settings']['#type'] variable's value to 'fieldset' in an implementation of hook_form_alter() or hook_form_FORM_ID_alter(), if it's equal to 'vertical_tabs'.
You don't need to change the access settings or walk the whole array recursively, the latter consumes unnecessarily too much resources.


/**
 * Disable Vertical tabs on a form with simply changing the value of $form['additional_settings']['#type']
 * @see https:// drupal.org/node/1048644
 */
function form_disable_vertical_tabs(&$form){
  // originally $form['additional_settings']['#type'] equals to 'vertical_tabs'
  if(isset($form['additional_settings']['#type']) && ($form['additional_settings']['#type'] === 'vertical_tabs')){
    $form['additional_settings']['#type'] = 'fieldset';
  }
}

/**
 * Implements hook_form_alter().
 */
function MYMODULEORTHEMENAME_form_alter(&$form, &$form_state, $form_id) {

  if($form_id == 'my_form_id'){
    // disable vertical tabs for this form
    form_disable_vertical_tabs($form);
  }
}

That's all, of course, substitute MYMODULEORTHEMENAME to your own module's or theme's name (the latter in a template.php file), and my_form_id to your form's id.

You can also disable the vertical fields only for users who do NOT have the administrator role:


/**
 * Implements hook_form_alter().
 */
function MYMODULEORTHEMENAME_form_alter(&$form, &$form_state, $form_id) {

  global $user;
  $is_administrator = in_array('administrator', array_values($user->roles));
 
  if($form_id == 'my_form_id'){
    // if $user does NOT have the administrator role.
    if (!$is_administrator) {
      // disable vertical tabs for this form
      form_disable_vertical_tabs($form);
    }
  }
}

In case someone is interested, I attached a patch to Dripman's sandbox module: #2080739: Simplify the method of disabling Vertical tabs with just changing the $form['additional_settings']['#type'] to 'fieldset'.

joyceg’s picture

Assigned: Unassigned » joyceg
Issue summary: View changes

I am working on this issue.

Anonymous’s picture

It took me quite a while to figure out preventing access to vertical tabs will render all nodes with status=0 when editing them. You should definitely NOT use this code:

$form['additional_settings']['#access'] = FALSE;

Thanks allot #29!!

joshuautley’s picture

#30 worked for us. Thank you!

Our use case was with the Bootstrap base theme. The vertical tabs looked odd #1 and #2 the anchor scroll behavior didn't work with our custom sub-theme.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.