How to add a field to a group with form_alter I have a group in a node set as a vertical tab, and I want to add some markup into this vertical tab via code. How can I do it?

Thanks!
Let's say that you are doing this in a module named custom.

First, take a look at how the form is structured using dsm($form) in custom.module.  Make sure you have the devel module enabled and that you have permissions to see devel's output.

&lt;?php

custom_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  dsm($form);
}


That will give you the structure of the $form array, which you can then add your markup to.  So, let's say that you want to add some markup to the author pane in the vertical tabs.  From the output from dsm($form), we see that we are working with $form['author'].

So, in custom_form_alter(), we simply add the markup element we desire using the standards documented in the Drupal 7 Form API.

In the code below, I also give the custom element (which I have aptly named "custom") a weight, so it appears above the other elements.

/**
 * Implements hook_form_alter().
 */
function custom_form_alter(&amp;$form, $form_state, $form_id) {
  // Add custom markup to the "Authoring Information" tab when adding or editing a page.
  if ($form_id == 'page_node_form') {
    $form['author']['custom']['#markup'] = 'Text goes here';
    $form['author']['custom']['#weight'] = -9;
  }
}


Also, rather than using an if statement to target the form id, I could have used hook_form_FORM_ID_alter(), like this:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function custom_form_page_node_form_alter(&amp;$form, $form_state, $form_id) {
  // Add custom markup to the "Authoring Information" tab when adding or editing a page.
  $form['author']['custom']['#markup'] = 'Text goes here';
  $form['author']['custom']['#weight'] = -9;
}