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 feature to reorder fields in a typical node form with the aim of giving greater prominence to the body field and less to the menu and category fields.
We will be using the mysite module created earlier in this book to contain our
hook_form_alter(). It is also recommended that the Devel module be enabled to help with diagnostic prints and other debugging efforts.
Navigate to the mysite module folder at
sites/all/modules/mysite to perform the following steps:
mysite.moduleand open it in an editor.