Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
1. create a node.
2. open /admin/content on 2 browser tabs.
3. on the 1st tab delete the created node.
4. on the 2nd tab select the node created in step 1.
5. select the "Delete content" action.
6. click the "appy to selected items"
Now, there is an warning message:
Warning: array_filter() expects parameter 1 to be array, null given in Drupal\views\Plugin\views\field\BulkForm->viewsFormValidate() (line 464 of core/modules/views/src/Plugin/views/field/BulkForm.php).
Proposed resolution
Don't show this error.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#17 | 3030989-17.patch | 4.3 KB | Lendude |
#17 | interdiff-3030989-15-17.txt | 3.96 KB | Lendude |
#15 | 3030989-13.patch | 3.84 KB | emyu01 |
#15 | interdiff_3030989_8-13.txt | 2.85 KB | emyu01 |
Comments
Comment #2
kaszarobertComment #4
nisha_gupta CreditAttribution: nisha_gupta at NeoSoft Technologies commentedThis patch works for me. Need review
Comment #5
LendudeThis should use $this->messager
The early return would mean all the entities are not deleted, shouldn't we just skip the one we can't delete?
trailing whitespace
Also, this needs a test
Comment #6
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere I have tried to address comment #5.
Comment #7
emyu01 CreditAttribution: emyu01 as a volunteer commentedHi, this is the error I got while trying to replicate
The patch 3030989-6.patch also did not have any effect on the error displayed.
Comment #8
LendudeI also see the error in #7, this is also what an automated test for this shows. Updated the IS to reflect the new error.
Here is a test and a new fix for this. No interdiff because this is a whole new approach.
Comment #10
emyu01 CreditAttribution: emyu01 as a volunteer commentedPatch applied cleanly and works as expected.
Comment #11
catchIt looks like we don't have coverage for the case where multiple nodes are selected, and only one is deleted?
Comment #12
emyu01 CreditAttribution: emyu01 as a volunteer commentedhello @catch,
Attached is an updated patch including interdiff fixing error when multiple nodes selected but one or more but not all are already deleted. Also fixed error when multiple nodes selected and all have already been deleted. Tests to cover both cases have been added too.
Comment #14
emyu01 CreditAttribution: emyu01 as a volunteer commentedComment #15
emyu01 CreditAttribution: emyu01 as a volunteer commentedPatch is re-attached for review.
Comment #17
LendudeThanks @emyu01, this fixes the new tests. The error only occurs when all nodes have been deleted. The current behaviour is that when you select one node and that node doesn't exist (but there are still other nodes), you get returned to the bulk form page without any messages.
Not sure if that is the best behaviour, but it is better than a warning.
Comment #18
emyu01 CreditAttribution: emyu01 as a volunteer commentedGreat! thanks @Lendude.
Comment #19
emyu01 CreditAttribution: emyu01 as a volunteer commentedPatch tested and looks all good.
Comment #24
catchCommitted c266bb6 and pushed to 9.1.x, and cherry-picked back to 8.8.x. Thanks!