I have a page that is displaying a form, and I want to add some text to the top of it.

I create my own module for the form, and have it set up like this:

function hook_menu(){
  $items['page'] = array(
    'page callback' => 'form_function',

function form_function() {
  $form = drupal_get_form('return_form');
  return $form;

function return_form(...){
  $form['element'] = ...
    .. ;

I want to add onto this form with a paragraph or two to go above the form. I looked at the form api for something i could use from '#type' but I found nothing. Any suggestions are welcome.


you could try using hook_form_alter()

For e.g.

function your_module_name_form_alter(&$form, &$form_state, $form_id){
  if($form_id == 'your_form_id'){
    //First element in the form.
     $form['element']['#prefix'] = '<div>Your paragraph before the form.</div>'

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.