More specifically, I am using Location in Drupal 7 to allow people to add location to nodes, but I want it to appear at the top of the vertical tabs fieldgroup.


An alternative to user842's answer (for those who are interested in a more code-based solution) is to set the weights on all the form items whose group is "additional_settings". The idea here is, higher the weight, lower the tab will appear, where the default is the one with the lowest weight (or one whose weight is not set).

To do this without modifying core code, create a module with a very large weight (see weight module for a module-based, or this post for a DB-based approach). Specifying the weight is important so that the module can be executed later than other modules which may change the order of the tabs. In this module, implement hook_form_alter, or hook_node_form_alter, which exposes the $form array.

At this point, you can look at the $form array, and pick out the indices that correspond to the vertical tabs whose order you wish to edit. One way to look at the $form array is by printing it out (via drupal_set_message($form) in the hook_form_alter or hook_node_form_alter). This array is huge, so you may want to run some kind of browser search to find the items that you want.

The indices that correspond to items on the vertical tabs are items with #group set to additional_settings (so you can search for the string "additional_settings"). For example, you may see the following when you print out the $form array:

   [path] => Array
           [#group] => additional_settings
           [#weight] => 314159265359

and this is showing that path which corresponds to the location tab in the vertical tabs has a large weight 314159265359, which might be the reason that it is showing last in the vertical tabs.

With this info, you can now change the order of this tab in your hook by decreasing the value of the weight:

// set a small weight for the path tab
$form['path']['#weight'] = -1;

in your hook. Notice that weights can also be negative. You can do this for some/every tab (by going through and changing their weights).

This unfortunately doesn't work for all situations. If the #weight of some vertical tab is unset, somehow, that tab will bubble to the top. You can fix that by giving the tab. The source-code might look something like

   Implements hook_form_FORMID_alter, hook_node_form_alter.
   Changes the $form array to reorder vertical tabs.
function reorder_vertical_tabs_node_form_alter(&$form, &$form_state, $form_id)
   // move 'location' to the top (as the default)
   $form['path']['#weight'] = -1;

   // move 'themekey' under 'locations'
   $form['themekey_ui_themes']['#weight'] = 0;

   // move 'published/unpublished' down
   $form['options']['#weight'] = 100;

From experience, I do not think you can change the order of the vertical tabs by setting $form['#after_build']. At that point, the order of the vertical tabs are already set.


The Renderable elements module enables you to will make (additional) elements (such as anything in the vertical tabs) available of existing entities on the manage forms/display screens so you can rearrange the fields through Field UI.


You can simply use the Vertical Tabs Config module.

This module allows you to:

  • Hide vertical tabs on add/edit node pages depending on content type and role.
  • Decide vertical tabs order.


You may need to clear drupal's and/or browsers cache if you don't see any changes after modifying vertical tabs order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.