1

I want to add a text header to the core contact form (between the title and the "Name" field). How can I achieve this?

3

Just like Rylyn said you can use the #prefix attribute. You could change your form with the hook_form_alter:

 function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
    // replace the 'FORM-ID' with the actual id of the contact form 
    if ($form_id == 'FORM-ID') {
       $form['name'] = array (
          '#type' => 'textfield',
          '#title' => 'your_title',
          '#prefix' => 'your_text_header'
       );
    }
 }
1

You can use "#prefix" attribute, like :

$form['name'] = array (
     '#type' => 'textfield',
     '#title' => 'your_title',
     '#prefix' => 'your_text_header',
);

And "#suffix" is opposite.

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.