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
The permissions are not always in the correct order because the PermissionHandler sorts on title which can contain markup if you've used t() with placeholders.
Proposed resolution
strip tags from the title before sorting.
Before:
After
Comment | File | Size | Author |
---|---|---|---|
#27 | 2804947-27.patch | 5.44 KB | immaculatexavier |
#26 | 2804947-169.patch | 5.44 KB | immaculatexavier |
#23 | 2804947-23.patch | 4.57 KB | marcvangend |
#16 | interdiff-14_16.txt | 3.79 KB | anmolgoyal74 |
#16 | 2804947-16.patch | 4.82 KB | anmolgoyal74 |
Issue fork drupal-2804947
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
benjy CreditAttribution: benjy at PreviousNext commentedHeres a patch this improves on things but it still doesn't seem quite right as Administer Entity Print is at the bottom of my permission list rather than at the top.
Comment #3
benjy CreditAttribution: benjy at PreviousNext commentedFixed this for my use case, the key part was the strip_tags() as I was using %placeholders in my permission titles and the sort was based on the markup :)
Comment #5
cilefen CreditAttribution: cilefen commentedIt should be easy to create a test for this.
Comment #7
LoMo CreditAttribution: LoMo as a volunteer commentedI would be marking this RTBC, since manual testing shows that the patch works, but since I'm also adding to the patch with the requested tests, I guess the status needs to stay on "Needs review". But I think this is now committable. We should see the "test-only" patch fail and the "complete" patch should pass.
Comment #9
LoMo CreditAttribution: LoMo as a volunteer commentedRe #8: Good. That is what we want to see. The new test, on its own, fails, but passes with the bugfix patch. :-)
Comment #13
joachim CreditAttribution: joachim as a volunteer commentedCouple of nitpicks, but apart from that looks good.
A comment here to explain why strip_tags() is used would be helpful.
I don't think we need to reference this issue -- the comment suffices. (And there is always git blame!)
Also, first paragraph of the docblock needs to be a single line.
Comment #14
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedThe patch includes the changes mentioned in #13.
Comment #16
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedUpdated the patch as per the coding standard.
Comment #22
larowlanComment #23
marcvangendThis is a re-roll of #16, not addressing the test failure yet.
Comment #24
marcvangendComment #26
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch against 9.4.x
Comment #27
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch against 9.4.x
Comment #30
ankithashetty