exposedFormSubmit example


      }
    }

    $view = $form_state->get('view');
    $view->exposed_data = $values;
    $view->exposed_raw_input = [];

    $exclude = ['submit', 'form_build_id', 'form_id', 'form_token', 'exposed_form_plugin', 'reset'];
    /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase $exposed_form_plugin */
    $exposed_form_plugin = $view->display_handler->getPlugin('exposed_form');
    $exposed_form_plugin->exposedFormSubmit($form$form_state$exclude);
    foreach ($values as $key => $value) {
      if (!empty($key) && !in_array($key$exclude)) {
        if (is_array($value)) {
          // Handle checkboxes, we only want to include the checked options.           // @todo revisit the need for this when           // https://www.drupal.org/node/342316 is resolved.           $checked = Checkboxes::getCheckedCheckboxes($value);
          foreach ($checked as $option_id) {
            $view->exposed_raw_input[$key][$option_id] = $value[$option_id];
          }
        }
        

  }

  /** * {@inheritdoc} */
  public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {
    if (!$form_state->isValueEmpty('op') && $form_state->getValue('op') == $this->options['reset_button_label']) {
      $this->resetForm($form$form_state);
    }
    if ($pager_plugin = $form_state->get('pager_plugin')) {
      $pager_plugin->exposedFormSubmit($form$form_state$exclude);
      $exclude[] = 'pager_plugin';
    }
  }

  /** * Resets all the states of the exposed form. * * This method is called when the "Reset" button is triggered. Clears * user inputs, stored session, and the form state. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */
Home | Imprint | This part of the site doesn't use cookies.