You are here

public function WebformSubmissionFilterForm::submitForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformSubmissionFilterForm.php \Drupal\webform\Form\WebformSubmissionFilterForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/WebformSubmissionFilterForm.php, line 89

Class

WebformSubmissionFilterForm
Provides the webform submission filter form.

Namespace

Drupal\webform\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $query = [
    'search' => trim($form_state
      ->getValue('search')),
    'state' => trim($form_state
      ->getValue('state')),
    'entity' => trim($form_state
      ->getValue('entity')),
  ];
  $query = array_filter($query);
  if (!empty($query['entity']) && preg_match('#\\(([^)]+)\\)#', $query['entity'], $match)) {
    $query['entity'] = $match[1];
  }
  $form_state
    ->setRedirect($this
    ->getRouteMatch()
    ->getRouteName(), $this
    ->getRouteMatch()
    ->getRawParameters()
    ->all(), [
    'query' => $query,
  ]);
}