protected function getRedirectParams(array $form, FormStateInterface $form_state) {
    $params = [
      'location' => array_filter($form_state->getValue('location')),
      'class' => $form_state->getValue('class_name'),
      'category' => $form_state->getValue('category'),
      'filter_length' => $form_state->getValue('filter_length'),
    ];

    // Time of day is optional.
    $time_of_day = array_filter($form_state->getValue('time_of_day'));
    if (!empty($time_of_day)) {
      $params['time_of_day'] = array_values($time_of_day);
    }

    // Get date.
    /** @var \Drupal\Core\Datetime\DrupalDateTime $date */
    $date = $form_state->getValue('filter_date');
    $params['filter_date'] = $date->format(self::$dateFilterFormat);

    // Toggle filter_length if user has selected more than 1 location and week period.
    if ($params['filter_length'] == 'week' && count($params['location']) > 1) {
      $params['filter_length'] = 'day';
      drupal_set_message(t('Search results across multiple locations are limited to a single day.'), 'warning');
    }

    return $params;
  }
protected function getRedirectParams(array $form, FormStateInterface $form_state) {
    $params = [
      'location' => array_filter($form_state->getValue('location')),
      'class' => $form_state->getValue('class_name'),
      'category' => $form_state->getValue('category'),
      'filter_length' => $form_state->getValue('filter_length'),
    ];

    // Time of day is optional.
    $time_of_day = array_filter($form_state->getValue('time_of_day'));
    if (!empty($time_of_day)) {
      $params['time_of_day'] = array_values($time_of_day);
    }

    // Get date.
    /** @var \Drupal\Core\Datetime\DrupalDateTime $date */
    $date = $form_state->getValue('filter_date');
    $params['filter_date'] = $date->format(self::$dateFilterFormat);

    // Toggle filter_length if user has selected more than 1 location and week period.
    if ($params['filter_length'] == 'week' && count($params['location']) > 1) {
      $params['filter_length'] = 'day';
      drupal_set_message(t('Search results across multiple locations are limited to a single day.'), 'warning');
    }

    return $params;
  }
protected function getRedirectParams ( array $ form , FormStateInterface $ form_state ) { $ params = [ 'location' => array_filter ( $ form_state -> getValue ( 'location' ) ) , 'class' => $ form_state -> getValue ( 'class_name' ) , 'category' => $ form_state -> getValue ( 'category' ) , 'filter_length' => $ form_state -> getValue ( 'filter_length' ) , ] ; // Time of day is optional. $ time_of_day = array_filter ( $ form_state -> getValue ( 'time_of_day' ) ) ; if ( ! empty ( $ time_of_day ) ) { $ params [ 'time_of_day' ] = array_values ( $ time_of_day ) ; } // Get date. /** @var \Drupal\Core\Datetime\DrupalDateTime $date */ $ date = $ form_state -> getValue ( 'filter_date' ) ; $ params [ 'filter_date' ] = $ date -> format ( self :: $ dateFilterFormat ) ; // Toggle filter_length if user has selected more than 1 location and week period. if ( $ params [ 'filter_length' ] == 'week' && count ( $ params [ 'location' ] ) > 1 ) { $ params [ 'filter_length' ] = 'day' ; drupal_set_message ( t ( 'Search results across multiple locations are limited to a single day.' ) , 'warning' ) ; } return $ params ; }
Get redirect parameters.

@param array $form
Drupal form.
@param \Drupal\Core\Form\FormStateInterface $form_state
Form state.

@return array
Redirect parameters.
Get redirect parameters .