Drupal – Add HTML Markup in Form

I would like to add some HTML elements in the login form. This can be done by hook_form_alter() and the markup could be added as follow.

function <your module>_form_alter(&$form, &$form_state, $form_id) {
  //print $form_id.'<br/>';
  if ($form_id == 'user_login') {
    //print_r($form);
    $form['html_markup'] = array('#value' => t('<a href="https://ykyuen.wordpress.com">Eureka!</a>'));
  }
}

 

Done =)

Reference: Drupal 6 Form API Reference

One thought on “Drupal – Add HTML Markup in Form”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.