fbpx Allowing unfiltered content on the Drupal contact page | ComputerMinds Skip to main content

Allowing unfiltered content on the Drupal contact page

16th Dec 2007

Mike Dixon

Senior Mind

The contact page exposed by the Drupal contact module is great, it allows you to put together a contact form quickly and easily. But there is one small(ish) problem, the header text for the form is being filtered - which prevents you from using certain tags (for example embed). We found this problem when trying to embed a youtube movie onto the drupal contact form.

The solution is a little bit of themeing - put the following in your template.php file, you will have to be a bit carefull as your now not filtering your output - so you HAVE to be able to trust the person editing the contact form details.

 


/**
* Customise the contact page
*/
function theme_contact_mail_page($form){
    $output = variable_get('contact_form_information', t('You can leave a message using the contact form below.'));  
    //NOTE this is not being filtered so we can include HTML in the contact form
    unset($form['contact_information']);
    $output .= drupal_render($form);
    return $output;
}