function _webform_honeypot_form_validate in Webform 8.5
Same name and namespace in other branches
- 6.x third_party_settings/webform.honeypot.inc \_webform_honeypot_form_validate()
Validate callback; Checks if honeypot or time_restriction is disabled and removes them from the third party settings values.
1 string reference to '_webform_honeypot_form_validate'
- _webform_honeypot_form in third_party_settings/
webform.honeypot.inc - Alter webform third party settings webforms to include Honeypot configuration.
File
- third_party_settings/
webform.honeypot.inc, line 121 - Integrates third party settings on the Honeypot module's behalf.
Code
function _webform_honeypot_form_validate(&$form, FormStateInterface $form_state) {
$third_party_settings = $form_state
->getValue('third_party_settings');
if ($form_state
->get('honeypot_disabled') || empty($third_party_settings['honeypot']['honeypot'])) {
unset($third_party_settings['honeypot']['honeypot']);
}
if ($form_state
->get('time_restriction_disabled') || empty($third_party_settings['honeypot']['time_restriction'])) {
unset($third_party_settings['honeypot']['time_restriction']);
}
$form_state
->setValue('third_party_settings', $third_party_settings);
}