function antibot_webform_third_party_settings_form_alter in Webform 8.5
Same name and namespace in other branches
- 6.x third_party_settings/webform.antibot.inc \antibot_webform_third_party_settings_form_alter()
Implements hook_webform_third_party_settings_form_alter().
File
- third_party_settings/
webform.antibot.inc, line 108 - Integrates third party settings on the Antibot module's behalf.
Code
function antibot_webform_third_party_settings_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\webform\WebformThirdPartySettingsManagerInterface $third_party_settings_manager */
$third_party_settings_manager = \Drupal::service('webform.third_party_settings_manager');
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $form_state
->getFormObject()
->getEntity();
$antibot = $webform
->getThirdPartySetting('antibot', 'antibot');
if ($third_party_settings_manager
->getThirdPartySetting('antibot', 'antibot')) {
$antibot_state = WEBFORM_ANTIBOT_ENABLED_WEBFORM;
}
else {
$antibot_state = WEBFORM_ANTIBOT_NEUTRAL;
}
_webform_antibot_form($form, $form_state, $antibot, $antibot_state, t('@label webform', [
'@label' => $webform
->label(),
]));
}