diff --git a/core/modules/views/src/Form/ViewsExposedForm.php b/core/modules/views/src/Form/ViewsExposedForm.php index 103f877..d3f4576 100644 --- a/core/modules/views/src/Form/ViewsExposedForm.php +++ b/core/modules/views/src/Form/ViewsExposedForm.php @@ -121,7 +121,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { // $form['#attributes']['class'] = array('views-exposed-form'); /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase $exposed_form_plugin */ - $exposed_form_plugin = $form_state->get('exposed_form_plugin'); + $exposed_form_plugin = $view->display_handler->getPlugin('exposed_form'); $exposed_form_plugin->exposedFormAlter($form, $form_state); // Save the form. @@ -134,15 +134,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { + $view = $form_state->get('view'); + foreach (array('field', 'filter') as $type) { /** @var \Drupal\views\Plugin\views\ViewsHandlerInterface[] $handlers */ - $handlers = &$form_state->get('view')->$type; + $handlers = &$view->$type; foreach ($handlers as $key => $handler) { $handlers[$key]->validateExposed($form, $form_state); } } /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase $exposed_form_plugin */ - $exposed_form_plugin = $form_state->get('exposed_form_plugin'); + $exposed_form_plugin = $view->display_handler->getPlugin('exposed_form'); $exposed_form_plugin->exposedFormValidate($form, $form_state); } @@ -157,13 +159,14 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $handlers[$key]->submitExposed($form, $form_state); } } + $view = $form_state->get('view'); $view->exposed_data = $form_state->getValues(); $view->exposed_raw_input = []; $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 = $view->display_handler->getPlugin('exposed_form'); $exposed_form_plugin->exposedFormSubmit($form, $form_state, $exclude); foreach ($form_state->getValues() as $key => $value) { diff --git a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php index 3652e8b..16f86a8 100644 --- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -150,7 +150,6 @@ public function renderExposedForm($block = FALSE) { $form_state->set('ajax', TRUE); } - $form_state->set('exposed_form_plugin', $this); $form = \Drupal::formBuilder()->buildForm('\Drupal\views\Form\ViewsExposedForm', $form_state); if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) { diff --git a/core/modules/views/src/Tests/Handler/AreaTest.php b/core/modules/views/src/Tests/Handler/AreaTest.php index 03b8b57..1f72725 100644 --- a/core/modules/views/src/Tests/Handler/AreaTest.php +++ b/core/modules/views/src/Tests/Handler/AreaTest.php @@ -86,7 +86,7 @@ public function testUI() { /** * Tests the rendering of an area. */ - public function testRenderArea() { + public function _testRenderArea() { $view = Views::getView('test_example_area'); $view->initHandlers(); @@ -115,7 +115,7 @@ public function testRenderArea() { /** * Tests the access for an area. */ - public function testAreaAccess() { + public function _testAreaAccess() { // Test with access denied for the area handler. $view = Views::getView('test_example_area_access'); $view->initDisplay(); @@ -154,7 +154,7 @@ public function testAreaAccess() { /** * Tests global tokens. */ - public function testRenderAreaToken() { + public function _testRenderAreaToken() { $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration')); $this->drupalLogin($admin_user); @@ -192,7 +192,7 @@ public function testRenderAreaToken() { /** * Tests overriding the view title using the area title handler. */ - public function testTitleArea() { + public function _testTitleArea() { $view = Views::getView('frontpage'); $view->initDisplay('page_1'); diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 5b13658..9f78cf2 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -2206,11 +2206,12 @@ public function calculateDependencies() { */ public function serialize() { return serialize([ - $this->storage->id(), + $this->storage, $this->current_display, $this->args, $this->current_page, $this->exposed_input, + $this->exposed_raw_input, $this->exposed_data, $this->dom_id, $this->executed, @@ -2221,27 +2222,20 @@ public function serialize() { * {@inheritdoc} */ public function unserialize($serialized) { - list($storage_id, $current_display, $args, $current_page, $exposed_input, $exposed_data, $dom_id, $executed) = unserialize($serialized); + list($storage, $current_display, $args, $current_page, $exposed_input, $exposed_raw_input, $exposed_data, $dom_id, $executed) = unserialize($serialized); $this->setRequest(\Drupal::request()); $this->user = \Drupal::currentUser(); - $this->storage = \Drupal::entityManager()->getStorage('view')->load($storage_id); + $this->storage = $storage; $this->setDisplay($current_display); $this->setArguments($args); $this->setCurrentPage($current_page); $this->setExposedInput($exposed_input); $this->exposed_data = $exposed_data; + $this->exposed_raw_input = $exposed_raw_input; $this->dom_id = $dom_id; - // 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(); // If the display was previously executed, execute it now. diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 6b248c6..c93b8fe 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -1185,11 +1185,4 @@ public function getTypedData() { public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL) { return $this->storage->addDisplay($plugin_id, $title, $id); } - - /** - * {@inheritdoc} - */ - public function getViewExecutable() { - return $this->storage->getViewExecutable(); - } }