You are here

function webform_form_views_exposed_form_alter in Webform 8.5

Same name and namespace in other branches
  1. 6.x includes/webform.form_alter.inc \webform_form_views_exposed_form_alter()

Implements hook_form_FORM_ID_alter() for views exposed form.

File

includes/webform.form_alter.inc, line 143
Webform module form alter hooks.

Code

function webform_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  /** @var \Drupal\views\ViewExecutable $view */
  $view = $form_state
    ->get('view');

  // Check if this a is webform submission view.
  // @see \Drupal\webform\WebformSubmissionListBuilder::buildSubmissionViews
  if (isset($view->webform_submission_view)) {
    $form['#action'] = Url::fromRoute(\Drupal::routeMatch()
      ->getRouteName(), \Drupal::routeMatch()
      ->getRawParameters()
      ->all())
      ->toString();
  }
}