function spamicide_form_alter in Spamicide 6
Same name and namespace in other branches
- 8 spamicide.module \spamicide_form_alter()
- 5 spamicide.module \spamicide_form_alter()
- 7 spamicide.module \spamicide_form_alter()
Implementation of hook_form_alter
Parameters
$form_id:
$form:
File
- ./
spamicide.module, line 297 - This module provides yet another tool to eliminate spam.
Code
function spamicide_form_alter(&$form, $form_state, $form_id) {
if (strpos($form_id, 'search') !== FALSE || strpos($form_id, 'update_script') !== FALSE) {
//ignore the search & update forms
return;
}
$spamicide_field = _spamicide_get_field($form_id);
if ($spamicide_field) {
$form['#pre_render'][] = '_spamicide_pre_render';
$spamicide_description = _spamicide_get_description();
$form[$spamicide_field] = array(
'#type' => 'textfield',
'#size' => 20,
'#description' => $spamicide_description,
'#name' => $spamicide_field,
'#post_render' => array(
'_spamicide_field_post_render',
),
);
$spam_fields = _spamicide_get_all_fields();
$form['destination'] = array(
'#type' => 'value',
'#value' => drupal_get_destination(),
);
$form['spamicide']['#element_validate'] = array(
'spamicide_validate',
);
spamicide_field_place_field($form, $form_id);
}
elseif (user_access('administer spamicide') && variable_get('spamicide_administration_mode', TRUE) && arg(0) != 'admin') {
$form['spamicide'] = array(
'#type' => 'fieldset',
'#title' => t('Spamicide'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['spamicide']['add_spamicide'] = array(
'#value' => l(t('Add Spamicide protection to this form.'), "admin/settings/spamicide/spamicide_form/add/{$form_id}", array()),
);
}
else {
return;
}
}