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.
This depends on #1851082: Add a base bulk form handler class .
Ideally this will be supplanted by #1839516: Introduce entity operation providers, but it doesn't hurt to get this in regardless.
Comment | File | Size | Author |
---|---|---|---|
#9 | user-bulk-form-1894972-9.patch | 6.33 KB | tim.plunkett |
#7 | user-bulk-form-1894972-7.patch | 5.66 KB | tim.plunkett |
#7 | interdiff.txt | 4.08 KB | tim.plunkett |
#4 | user-bulk-form-1894972-4.patch | 5.28 KB | tim.plunkett |
#4 | interdiff.txt | 1.07 KB | tim.plunkett |
Comments
Comment #1
tim.plunkettThe base class went in! This was pretty fun to write.
Comment #2
tim.plunkettRerolled after #1855792: Move user test modules into tests/modules/ directory
Comment #3
dawehnerThis looks really good so far.
Don't we want to use the ExtensionHandler already?
Now that click sortable is the default, we probably don't want to mark that as click sortable.
Comment #4
tim.plunkettGood ideas!
Comment #5
dawehnerJust two really small points, before I think this is RTBC.
Just to avoid confusion I would suggest to use $row_index here instead of $account.
We could load all available user operations in the test, so it's clearer why we have 5 of them.
Comment #6
damiankloip CreditAttribution: damiankloip commentedYeah, this is looking pretty good.
Nice!
Probably not, but is it any better to just collect the ids here and use drupal_map_assoc below in the $submit array?
I guess this is what Daniel means, but we could assert these values against the values (or just count) of ...->invokeAll('user_operations').
This should/could probably assert that the user is not actually listed in the view anymore? I know we had a couple of issues with that in the initial patch for the action bulk form stuff.
I'm not sure what this should be changed to but I'm not sure about what it is currently :?
Comment #7
tim.plunkettI went with $result instead of $row_index, since its a stdClass not an integer, but that is much less confusing than $account.
I added the drupal_map_assoc(), but took it one step further to minimize the changes we'll need when we kill the old submit handler.
I changed the view to filter on status, and added the assertions.
Not sure what @damiankloip had in mind for the help text, but I think that's fine.
I've also added in the validation the old form provided.
Comment #8
dawehnerOh you are right. Your change is way better.
Comment #9
tim.plunkettErp, my interdiff was right but the patch was missing the validate.
Comment #11
tim.plunkettTestbot fluke, it passed: http://qa.drupal.org/pifr/test/428348
Comment #12
tim.plunkettSince this blocks a major, it is also major. No real harm since it still applies and is RTBC.
Comment #13
webchickTested this, and still needs a little bit of work:
1) It seems to break the views preview once I add one of these fields to the view.
2) To be a total jerk, I attempted to add the Administrator role to Anonymous, and that resulted in a fatal error:
Granted, I'm being a jerk, but it still seems like it should fail more gracefully in that case.
3) In non-jerk land, I attempted to add the Administrator role and Cancel the account of an account called "blockme", and got:
and
...respectively. The user was of course blocked, in case that makes a difference. Tim says this is a known thing and it's already dealt with in #1851086: Replace admin/people with a View.
4) Then one minor cosmetic thing. It'd be nice if it didn't default to having a label, because I'm going to absolutely never want a label of "User bulk operations form" on this checkbox. :D
Also discovered that Views's contextual links are broken, and "Place a colon after the label" defaults to true, which is the opposite of core, but those don't have anything to do with this patch specifically.
Comment #14
tim.plunkettThis just presents the current hook_user_operations as a bulk form. #1851086: Replace admin/people with a View contains all of the test coverage and improvements to make it actually work in real use cases. So, let's just close this one and add the bulk form handler in the issue its needed for.