This article on adding a google map to Drupal's contact form is based on Norio's blog, however i shall attempt to create my own version as a backup tutorial, plus adding extra notes for those users having difficulties to embed the map.
1. Download and install the GMap module.
2. Go to your admin modules page and activate the contact, gmap and gmap macro builder module as depicted below:


3. Request a Google Map API Key, afterwards paste the key to your GMap config page and save the configuration.
4. Go to your input formats config, then configure the Full HTML "input format", and tick on "GMap macro expander" on "Filters" tab, failure to do so will output the GMap macro text instead of the actual Google Map.

5. Start designing your own map using the "Build a GMap Macro" located under admin "site configuration".
6. After finished, copy and paste the GMap generated macro text to site-wide contact form setting ("Additional Information" field under "Settings" tab).
7. Open template.php file, and add the following function (adjust the theme to your "theme name", if your theme name is example_123, then the function name will be example_123_contact_mail_page, this is a common mistake so be careful):
function theme_contact_mail_page($form)
{
$output = check_markup(variable_get('contact_form_information',
t('You can leave a message using the contact form below.')));
unset($form['contact_information']); $output .= drupal_render($form);
return $output;
}
Recent comments