The Form API, like many other components of Drupal, provides options to order form elements through the use of weights. In this recipe, we will exercise this and other features to reorganize the structure of a typical node form.
We will be using the mysite module created earlier in this book to contain our hook_form_alter()
. Fields provided by the Menu module will be among those that we will be looking to tweak and it is therefore assumed that the module is enabled.
It is also recommended that the Devel module be enabled to help with diagnostic prints and other debugging efforts.
In this recipe, we are going to look to restructure the vertical tabs present at the bottom of every node form. Navigate to the mysite module folder at sites/all/modules/mysite
to perform the following steps:
1. Locate the file
mysite.module
and open it in an editor.2. Scroll down to the bottom and add the following function:
/** * Implements hook_form_BASE_FORM_ID_alter...