You are here

function webform_test_alter_hooks_form_alter in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/modules/webform_test_alter_hooks/webform_test_alter_hooks.module \webform_test_alter_hooks_form_alter()

Implements hook_form_alter().

File

tests/modules/webform_test_alter_hooks/webform_test_alter_hooks.module, line 17
Support module for webform that tests form and element alter hooks.

Code

function webform_test_alter_hooks_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (strpos($form_id, 'webform_') === 0) {
    \Drupal::messenger()
      ->addStatus(t("@hook: '@form_id' executed.", [
      '@hook' => 'hook_form_alter()',
      '@form_id' => $form_id,
    ]), TRUE);
  }
}