You are here

function honeypot_form_yamlform_admin_third_party_settings_form_alter in YAML Form 8

Implements hook_form_FORM_ID_alter().

File

third_party_settings/yamlform.honeypot.inc, line 130
Integrates third party settings on the Honeypot module's behalf.

Code

function honeypot_form_yamlform_admin_third_party_settings_form_alter(&$form, FormStateInterface $form_state) {

  /** @var \Drupal\yamlform\YamlFormThirdPartySettingsManagerInterface $third_party_settings_manager */
  $third_party_settings_manager = \Drupal::service('yamlform.third_party_settings_manager');
  $honeypot = $third_party_settings_manager
    ->getThirdPartySetting('honeypot', 'honeypot');
  $honeypot_state = \Drupal::config('honeypot.settings')
    ->get('protect_all_forms') ? YAMLFORM_HONEYPOT_ENABLED_ALL : YAMLFORM_HONEYPOT_NEUTRAL;
  $time_restriction = $third_party_settings_manager
    ->getThirdPartySetting('honeypot', 'time_restriction');
  $time_restriction_state = \Drupal::config('honeypot.settings')
    ->get('time_limit') == 0 ? YAMLFORM_HONEYPOT_DISABLED_ALL : YAMLFORM_HONEYPOT_NEUTRAL;
  _yamlform_honeypot_form($form, $form_state, $honeypot, $honeypot_state, $time_restriction, $time_restriction_state, t('all forms'));
}