function _cleantalk_form_alter in Anti Spam by CleanTalk 7.5
Same name and namespace in other branches
- 8.4 cleantalk.module \_cleantalk_form_alter()
- 8 cleantalk.module \_cleantalk_form_alter()
- 8.3 cleantalk.module \_cleantalk_form_alter()
- 7 cleantalk.module \_cleantalk_form_alter()
- 7.2 cleantalk.module \_cleantalk_form_alter()
- 7.4 cleantalk.module \_cleantalk_form_alter()
- 9.1.x cleantalk.module \_cleantalk_form_alter()
Cleantalk inner function - alters needed form.
1 call to _cleantalk_form_alter()
- cleantalk_form_alter in ./
cleantalk.module - Implements hook_form_BASE_FORM_ID_alter().
File
- ./
cleantalk.module, line 240 - Main CleanTalk integration module functions.
Code
function _cleantalk_form_alter(&$form, &$form_state, $form_id) {
if (user_access('administer modules') || path_is_admin(current_path()) && $form_id !== 'forum_node_form' || $form_id == 'search_form' || $form_id == 'user_login_form' || $form_id == 'search_block_form' || $form_id == 'user_login_block') {
return;
}
if (variable_get('cleantalk_link', 0) != 0) {
$form['terms_of_use'] = array(
'#type' => 'item',
'#markup' => t("<a href='https://cleantalk.org/drupal-anti-spam-module-wo-captcha'>Drupal spam</a> blocked by CleanTalk."),
'#required' => FALSE,
);
}
if ($form_id == 'user_register_form') {
$form['#validate'][] = 'cleantalk_validate_register';
}
else {
if (preg_match('|comment(.*?)_form|', $form_id)) {
$form['#validate'][] = 'cleantalk_validate_comment';
}
if (preg_match('|contact(.*?)_form|', $form_id)) {
$form['#validate'][] = 'cleantalk_validate_contact_message';
}
if (preg_match('|webform(.*?)_form|', $form_id)) {
$form['#validate'][] = 'cleantalk_validate_webform';
}
if (preg_match('|forum(.*?)_form|', $form_id)) {
$form['#validate'][] = 'cleantalk_validate_forum';
}
if (preg_match('|newsletter_(.*?)_form|', $form_id)) {
$form['#validate'][] = 'cleantalk_validate_newsletter';
}
}
}