Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I finally was able to put T&C on the contact page:
setup T&C text on /admin/config/people/legal
created a new view which shows "Legal terms and conditions" (use a block display)
fields:
Legal: Terms & Conditions (Terms & Conditions)
sort:
Legal: Version (desc)
Legal: Revision (desc)
pager: Display a specified number of items | 1 item
changed the contact page by using a panel variant
on the contact page layout added the T&C view block
Now T&C is shown on the contact page, but there are three problems:
1) cannot place T&C after the message box but before the send message button
2) no Accept T&C check box is shown
3) cannot change display style: if I change it on admin/config/people/legal, it is not reflected on view
Normally I don't like to hack modules so I just opened and copied the alter form part of the user register and created a new module to alter the contact form:
/**
* Implements hook_form_contact_site_form_alter().
* This function will add a phone number field to the site-wide contact form,
* by implementing hook_form_FORM_ID_alter().
*/
function YOURMODULENAME_form_contact_site_form_alter(&$form, &$form_state) {
global $user;
global $language;
$conditions = legal_get_conditions($language->language);
// Do nothing if there's no Terms and Conditions text set.
if (empty($conditions['conditions'])) {
return;
}
$form = array_merge($form, legal_display_fields($conditions));
// Disable checkbox if:
// - user is already registered (administer users);
// - users with 'administer users' can access registration on admin/user/user/create.
if (!empty($user->uid)) {
$form['legal']['legal_accept']['#attributes'] = array('disabled' => 'disabled');
$form['legal']['legal_accept']['#required'] = FALSE;
if (is_array($conditions['extras'])) {
foreach ($conditions['extras'] as $key => $label) {
if (!empty($label)) {
$form['legal'][$key]['#attributes'] = array('disabled' => 'disabled');
$form['legal'][$key]['#required'] = FALSE;
}
}
}
}
return theme('legal_display', array('form' => $form));
}
Comments
Comment #1
mandreato commented@tignux, did you ever solved this ?
I'm wondering if is it possible to have T&C on contact page too.
Thanks In Advance !
Comment #2
mandreato commentedI finally was able to put T&C on the contact page:
Now T&C is shown on the contact page, but there are three problems:
1) cannot place T&C after the message box but before the send message button
2) no Accept T&C check box is shown
3) cannot change display style: if I change it on admin/config/people/legal, it is not reflected on view
Comment #3
warmth commentedThanks for the info but I think this should be supported by defaul!
Comment #4
warmth commentedNormally I don't like to hack modules so I just opened and copied the alter form part of the user register and created a new module to alter the contact form:
Comment #5
new123456789 commentedAny updates on this?
Can the legal module be ingegrated with Webforms?
I'd like the T&C to be displayed ABOVE the webform...