I'd like to be able to change the title of my contact form in the modal window from being just "Contact" to something more descriptive. Is this possible? Seems like it is hard-coded.


cluke009’s picture

michaellenahan’s picture

The solution suggested by #1 changes the title for the default (non-pop-up) contact form.

However, even when the non-pop-up contact form's title is changed, the title text 'Contact' is given to the contact pop-up form by this code - so the original-poster is correct - the title-text 'Contact' is hard-coded into the module.

version 7.x-1.0
modal_forms.pages.inc (lines 104-120)

 * A modal contact callback.
function modal_forms_contact($js = NULL) {
  module_load_include('inc', 'contact', 'contact.pages');

  // Fall back if $js is not set.
  if (!$js) {
    return drupal_get_form('contact_site_form');

  $form_state = array(
    // 'title' => t('Contact'),
    'ajax' => TRUE,

I have commented out this line:
// 'title' => t('Contact'),

... so that the title of the non-pop-up contact form comes through unchanged.

This means that now, the solution in #1 will work as long as this line is commented out.

I know that this is hacking the module file - if anyone out there can add a suggestion on how to do this in an override rather than a hack, please let me know!

Otherwise I'll suggest this as a patch to the modal_forms module - it's best for the module not to override the form title.

Grateful for your thoughts!

frjo’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Assigned: Unassigned » frjo
Category: support » task
Status: Active » Fixed

@michaellenahan, I have committed your suggestion to 7-dev. Letting the default title be used instead of hardcoding it make a lot more sense. Thanks for suggesting it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.