You are here

class FormWebformSubmissionFormAlter in General Data Protection Regulation Compliance 8

Hook hook_form_webform_submission_form_alter().

Hierarchy

Expanded class hierarchy of FormWebformSubmissionFormAlter

1 file declares its use of FormWebformSubmissionFormAlter
gdpr_compliance.module in ./gdpr_compliance.module
Contains Hooks.

File

src/Hook/FormWebformSubmissionFormAlter.php, line 11

Namespace

Drupal\gdpr_compliance\Hook
View source
class FormWebformSubmissionFormAlter {

  /**
   * Hook.
   */
  public static function hook(&$form, FormStateInterface $form_state, $form_id) {
    $display = FALSE;
    $config = \Drupal::config('gdpr_compliance.settings');
    if ($config
      ->get('webform-mode') == 'all') {
      $display = TRUE;
    }
    elseif ($config
      ->get('webform-mode') == 'custom') {
      $bundles = $config
        ->get('webform-bundles');
      $formkey = substr($form_id, 19, -9);
      if (isset($bundles[$formkey]) && $bundles[$formkey]) {
        $display = TRUE;
      }
    }
    if ($display) {
      FormWarning::addWarning($form);
    }
  }

}

Members