function spamicide_form_alter in Spamicide 7
Same name and namespace in other branches
- 8 spamicide.module \spamicide_form_alter()
- 5 spamicide.module \spamicide_form_alter()
- 6 spamicide.module \spamicide_form_alter()
Implements hook_form_alter().
Parameters
$form_id:
$form_state:
$form:
File
- ./
spamicide.module, line 361 - 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;
}
module_load_include('inc', 'spamicide');
$spamicide_field = _spamicide_get_field($form_id);
if ($spamicide_field) {
//$sfile = 'public://' . variable_get('spamicide_dir', 'spamicide') . '/' . $spamicide_field . '.css';
$spamicide_description = _spamicide_get_description();
$spamicide_destination = drupal_get_destination();
$form[$spamicide_field] = array(
'#title' => check_plain(_spamicide_set_title(rtrim($spamicide_field))),
'#type' => 'textfield',
'#size' => 20,
'#description' => check_plain($spamicide_description),
//'#pre_render' => array('spamicide_pre_render'),
'#pre_render' => array(
'spamicide_pre_render_place_spamicide',
),
'#name' => $spamicide_field,
'#post_render' => array(
'_spamicide_field_post_render',
),
);
$form['#attached']['css'][] = 'public://' . variable_get('spamicide_dir', 'spamicide') . '/' . $spamicide_field . '.css';
$form['destination'] = array(
'#type' => 'value',
'#value' => $spamicide_destination['destination'],
);
$form['spamicide']['#element_validate'] = array(
'spamicide_validate',
);
}
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(
'#markup' => l(t('Add Spamicide protection to this form.'), "admin/config/people/spamicide/spamicide_form/add/{$form_id}"),
);
}
else {
return;
}
}