diff --git a/core/modules/views/src/Form/ViewsExposedForm.php b/core/modules/views/src/Form/ViewsExposedForm.php index 323e6c5..103f877 100644 --- a/core/modules/views/src/Form/ViewsExposedForm.php +++ b/core/modules/views/src/Form/ViewsExposedForm.php @@ -161,7 +161,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $view->exposed_data = $form_state->getValues(); $view->exposed_raw_input = []; - $exclude = array('submit', 'form_build_id', 'form_id', 'form_token', 'exposed_form_plugin', '', 'reset'); + $exclude = array('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 = $form_state->get('exposed_form_plugin'); $exposed_form_plugin->exposedFormSubmit($form, $form_state, $exclude); diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 0ca31da..25c6840 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -23,7 +23,7 @@ * An object to contain all of the data to generate a view, plus the member * functions to build the view query, execute the query and render the output. */ -class ViewExecutable { +class ViewExecutable implements \Serializable { use DependencySerializationTrait; /** @@ -2201,4 +2201,46 @@ public function calculateDependencies() { return $this->storage->calculateDependencies(); } + /** + * {@inheritdoc} + */ + public function serialize() { + return serialize([ + $this->storage->id(), + $this->current_display, + $this->args, + $this->current_page, + $this->exposed_input, + $this->exposed_data, + $this->dom_id + ]); + } + + /** + * {@inheritdoc} + */ + public function unserialize($serialized) { + list($storage_id, $current_display, $args, $current_page, $exposed_input, $exposed_data, $dom_id) = unserialize($serialized); + + $this->setRequest(\Drupal::request()); + $this->user = \Drupal::currentUser(); + + $this->storage = \Drupal::entityManager()->getStorage('view')->load($storage_id); + $this->setDisplay($current_display); + $this->setArguments($args); + $this->setCurrentPage($current_page); + $this->setExposedInput($exposed_input); + $this->exposed_data = $exposed_data; + + // Rebuild the exposed raw input. + $exclude = array('submit', 'form_build_id', 'form_id', 'form_token', 'exposed_form_plugin', 'reset'); + foreach ($this->exposed_data as $key => $value) { + if (!in_array($key, $exclude)) { + $this->exposed_raw_input[$key] = $value; + } + } + + $this->initHandlers(); + } + } diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 58a1734..440cc9c 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -816,14 +816,14 @@ public function cacheSet() { if (isset($executable->current_display)) { // Add the knowledge of the changed display, too. $this->changed_display[$executable->current_display] = TRUE; - unset($executable->current_display); + $executable->current_display = NULL; } - // Unset handlers; we don't want to write these into the cache. - unset($executable->display_handler); - unset($executable->default_display); + // Unset handlers. We don't want to write these into the cache. + $executable->display_handler = NULL; + $executable->default_display = NULL; $executable->query = NULL; - unset($executable->displayHandlers); + $executable->displayHandlers = NULL; \Drupal::service('user.tempstore')->get('views')->set($this->id(), $this); }