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.
Post new comment