function hook_honeypot_form_protections_alter in Honeypot 7
Same name and namespace in other branches
- 8 honeypot.api.php \hook_honeypot_form_protections_alter()
- 6 honeypot.api.php \hook_honeypot_form_protections_alter()
- 2.0.x honeypot.api.php \hook_honeypot_form_protections_alter()
Alter the honeypot protections added to a particular form.
Parameters
array $options: Protections that will be applied to the form. May be empty, or may include 'honeypot' and/or 'time_restriction'.
array $form: The Form API form to which protections will be added.
1 invocation of hook_honeypot_form_protections_alter()
- honeypot_add_form_protection in ./
honeypot.module - Form builder function to add different types of protection to forms.
File
- ./
honeypot.api.php, line 22 - API Functionality for Honeypot module.
Code
function hook_honeypot_form_protections_alter(&$options, $form) {
// Add 'time_restriction' protection to 'mymodule-form' if it's not set.
if ($form['form_id']['#value'] == 'mymodule_form' && !in_array('time_restriction', $options)) {
$options[] = 'time_restriction';
}
}