Contact form on maintenance mode page
-
29-09-2020 - |
Question
I'm using Drupal 7 and I wanted users to be able to contact me via email whilst I'm still working on the website. So my plan was to use 'create a contact form', as I don't want to expose my email address.
However whenever I try to add an input
element in the maintenance mode message it is completely ignored in the output. I think that this is because the message uses the filtered HTML file as I do have other bits of HTML the message that are rendering just fine, but I can't see any option to change which filter is used.
Is there a way to change the filter to full HTML or is there a better a option?
Solution
If you are comfortable with Custom coding, you can try following route
On your theme template.php implement template_preprocess_maintenace(), this will help you introducing new variables to maintenance page tpl file, something like below
function yourtheme_name_preprocess_maintenance_page(&$vars) {
if (function_exists('_your_form_builder_funtion')) {
$vars['your_custom_form'] = drupal_render(drupal_get_form('_your_form_builder_function'));
}
}
Now copy the maintenance-page.tpl.php in your custom theme templates folder and on the template file, you can use the variable like any other being already used. So somewhere on your maintenance-page.tpl.php add following
<div class="contact-form">
<?php print $your_custom_form; ?>
</div>