Download & Extend

Vertical tabs cannot be disabled

Project:Drupal core
Version:8.x-dev
Component:forms system
Category:feature request
Priority:minor
Assigned:Unassigned
Status:active
Issue tags:JavaScript

Issue Summary

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?

Comments

#1

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.

#2

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;}?

#3

Solution was found:

template.php :

<?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');
}
?>

#4

Title:Vertical Tabs issue in Drupal 7» Vertical tabs cannot be disabled
Category:bug report» feature request
Status:closed (works as designed)» active

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

#5

#6

Or here:

AttachmentSizeStatusTest resultOperations
disable_vertical_tabs.zip905 bytesIgnored: Check issue status.NoneNone

#7

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.

AttachmentSizeStatusTest resultOperations
verticaltabs_location.jpg47.33 KBIgnored: Check issue status.NoneNone

#8

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.

#9

Version:7.0» 8.x-dev

Features are added in head first

#10

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.

#11

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.

#12

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

#13

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.

#14

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.

#15

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;
  }

}

#16

Thanks @RogerRogers!

#17

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;
        }
    }
}

#18

Don't come up with crazy irrelevant tags please.

Otherwise, what #10 said.

#19

#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).

#20

If you want to disable a specific vertical tab

<?php
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;
  }
}
?>

#21

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.

#22

thanks a lot RogerRogers! that worked just fine!

#23

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

nobody click here