public static function FormContactMessageFormAlter::hook in General Data Protection Regulation Compliance 8
Hook.
1 call to FormContactMessageFormAlter::hook()
- gdpr_compliance_form_contact_message_form_alter in ./
gdpr_compliance.module - Implements hook_form_TYPE_alter().
File
- src/
Hook/ FormContactMessageFormAlter.php, line 16
Class
- FormContactMessageFormAlter
- Hook hook_form_contact_message_form_alter().
Namespace
Drupal\gdpr_compliance\HookCode
public static function hook(&$form, FormStateInterface $form_state, $form_id) {
$display = FALSE;
$config = \Drupal::config('gdpr_compliance.settings');
if ($config
->get('contact_message-mode') == 'all') {
$display = TRUE;
}
elseif ($config
->get('contact_message-mode') == 'custom') {
$bundles = $config
->get('contact_message-bundles');
$formkey = substr($form_id, 16, -5);
if (isset($bundles[$formkey]) && $bundles[$formkey]) {
$display = TRUE;
}
}
if ($display) {
FormWarning::addWarning($form);
}
}