How to turn off Vertical Tabs for a specific content type

I rarely do any heavy structural changes to node edit pages, so until today I hadn’t ever had a reason to disable vertical tabs on a specific content type, but there’s a first time for everything.

Now there are people who recommend turning it off by editing the $conf variable in the settings.php file… however, this is not an option on this particular site since it is running on Aegir, which automatically rewrites the settings.php file. So I had to find another way. I took a look at the vertical tabs code and came up with an easy solution.

Vertical tabs gets its settings info from a variable which it calls using variable_get(). Any variable that can be called with variable_get() can be changed with variable_set().

Here’s the code you will need to put in a custom module somewhere (you should almost always have a custom module to accompany your theme for situations like this):$config[‘yourcontenttype_node_form’] = FALSE;
variable_set(‘vertical_tabs_forms’, $config);

Obviously the ‘yourcontenttype’ needs to be replaced by the actual system name for the content type. Also you don’t need to run this code on each page load, so you should write a conditional to limit its scope. I run it in hook_form_alter and check the $form_id variable before running it. Technically you don’t even need to run it each time that particular form loads, but I leave it in there just in case somehow that variable gets cleared somewhere else.

Tags

Drupal ThemingDrupal Module DevelopmentAdvancedDrupal Tutorials

Drupal Contributions

  • Jquery Menu Module
  • Advanced Book Blocks
  • Advanced Taxonomy Blocks
  • Consistent Language Interface

PixelClever newsletter

Stay informed on our latest news!Email: * Previous issues

Drupal Tutorals RSS

Drupal Tutorials

How to Declare a Views Template Inside of a Module

The usual rule of thumb in web development is that styling (css, javascript etc…) should be done primarily inside of themes….[Read More]

How to Remove all SVN Folders from a Site

Svn has an annoying habit of adding thousands of folders and files into every level of your site when you put your code under…[Read More]

How to turn off Vertical Tabs for a specific content type

I rarely do any heavy structural changes to node edit pages, so until today I hadn’t ever had a reason to disable vertical tabs…[Read More]Drupal TutorialsDrupal Blog RSS

Drupal Blog

Free, Unlimited, Private Git Hosting – The Holy Grail of Version Control

If I were paid minimum wage for the time I have spent investigating various git and svn hosting services (both free and paid) I…[Read More]

Mac OSX + Drush = Time saved

The longer I have my mac the more things I find that drastically simplify my life as a Drupal developer. Now for fairness sake I…[Read More]

New to Drupal? A word from the wise: Never say newbie!

I have nothing against new Drupal users on Drupal.org, even the most advanced Drupal developers were new to Drupal at one point…[Read More]Drupal Blog

  • Home
  • Refund Policy
  • Privacy Policy
  • Business Ethics
  • View Drupal.org profile
  • Follow us on Twitter
  • Subscribe through RSS