diff --git a/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php b/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php index 8c5456c..327ebc1 100644 --- a/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php +++ b/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php @@ -51,6 +51,12 @@ public function testConstructor() { ->method('loadMultiple') ->will($this->returnValue($actions)); + $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + $entity_manager->expects($this->once()) + ->method('getStorage') + ->with('action') + ->will($this->returnValue($entity_storage)); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') ->disableOriginalConstructor() ->getMock(); @@ -81,7 +87,7 @@ public function testConstructor() { $definition['title'] = ''; $options = array(); - $node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', $definition, $entity_storage); + $node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', $definition, $entity_manager); $node_bulk_form->init($executable, $display, $options); $this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $node_bulk_form); diff --git a/core/modules/system/src/Plugin/views/field/BulkForm.php b/core/modules/system/src/Plugin/views/field/BulkForm.php index c9b8a67..dd78e12 100644 --- a/core/modules/system/src/Plugin/views/field/BulkForm.php +++ b/core/modules/system/src/Plugin/views/field/BulkForm.php @@ -362,6 +362,8 @@ protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = } /** + * Calculates a bulk form key. + * * @return string */ protected function calculateEntityBulkFormKey(EntityInterface $entity) { @@ -375,7 +377,11 @@ protected function calculateEntityBulkFormKey(EntityInterface $entity) { } /** + * Loads an entity based on a bulk form key. + * * @param string $bulk_form_key + * + * @return \Drupal\Core\Entity\EntityInterface */ protected function loadEntityFormBulkFormKey($bulk_form_key) { $key_parts = explode('-', $bulk_form_key); diff --git a/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php b/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php index 0c389cd..0eefa5a 100644 --- a/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php +++ b/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php @@ -51,6 +51,12 @@ public function testConstructor() { ->method('loadMultiple') ->will($this->returnValue($actions)); + $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + $entity_manager->expects($this->once()) + ->method('getStorage') + ->with('action') + ->will($this->returnValue($entity_storage)); + $views_data = $this->getMockBuilder('Drupal\views\ViewsData') ->disableOriginalConstructor() ->getMock(); @@ -81,7 +87,7 @@ public function testConstructor() { $definition['title'] = ''; $options = array(); - $user_bulk_form = new UserBulkForm(array(), 'user_bulk_form', $definition, $entity_storage); + $user_bulk_form = new UserBulkForm(array(), 'user_bulk_form', $definition, $entity_manager); $user_bulk_form->init($executable, $display, $options); $this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $user_bulk_form); diff --git a/core/modules/views/src/Form/ViewsForm.php b/core/modules/views/src/Form/ViewsForm.php index 1cabb8d..8a9a3e6 100644 --- a/core/modules/views/src/Form/ViewsForm.php +++ b/core/modules/views/src/Form/ViewsForm.php @@ -123,12 +123,6 @@ public function buildForm(array $form, FormStateInterface $form_state, ViewExecu } $form_state->set(['step_controller', 'views_form_views_form'], 'Drupal\views\Form\ViewsFormMainForm'); - // Cache the built form to prevent it from being rebuilt prior to validation - // and submission, which could lead to data being processed incorrectly, - // because the views rows (and thus, the form elements as well) have changed - // in the meantime. - $form_state->setCached(); - $form = array(); $query = $this->requestStack->getCurrentRequest()->query->all();