You are here

webform_deter.module in Webform Deter 8

Contains hooks for webform_deter module.

File

webform_deter.module
View source
<?php

/**
 * @file
 * Contains hooks for webform_deter module.
 */
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform_deter\Form\WebformDeterSettingsForm;

/**
 * Implements hook_webform_submission_form_alter().
 */
function webform_deter_webform_submission_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  $config = \Drupal::config('webform_deter.settings');
  $form['#attached']['library'][] = 'webform_deter/webform_deter';
  $form['#attached']['drupalSettings']['webform_deter']['warning_message'] = $config
    ->get('warning_message') ?? WebformDeterSettingsForm::DEFAULT_MESSAGE;
  $form['#attached']['drupalSettings']['webform_deter']['patterns'] = $config
    ->get('patterns') ?? [];
}