You are here

function webform_test_preprocess_page in Webform 6.x

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

Implements hook_preprocess_HOOK().

File

tests/modules/webform_test/webform_test.module, line 41
Support module for webform related testing.

Code

function webform_test_preprocess_page(&$variables) {
  if (!isset($_GET['generate']) && in_array(\Drupal::routeMatch()
    ->getRouteName(), [
    'entity.webform.canonical',
    'entity.webform.edit_form',
    'entity.webform.source_form',
  ]) && _webform_test_load_include(\Drupal::routeMatch()
    ->getRawParameter('webform'))) {
    $t_args = [
      ':href' => Url::fromRouteMatch(\Drupal::routeMatch())
        ->toString() . '?generate',
    ];
    \Drupal::messenger()
      ->addWarning(t('The below webform\'s elements are automatically generated and exported. You can regenerate the below elements by appending <a href=":href">?generate</a> to this page\'s URL.', $t_args));
  }
}