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
When adding the Roles Contextual filter to a view with users, it will give handler broken/missing.
Work done on user roles in #2248977 changed how user roles are handled, and broke the handling by Views.
Proposed resolution
Fix it.
Beta phase evaluation
Issue priority | Not critical because it's not a much used feature. |
---|---|
Unfrozen changes | Unfrozen because it only changes code necessary to fix a bug. |
Prioritized changes | The main goal of this issue is usability. |
Comment | File | Size | Author |
---|---|---|---|
#12 | 2405481-12.patch | 4.72 KB | Lendude |
#9 | 2405481-9.patch | 4.82 KB | Lendude |
#9 | interdiff-2405481-7-9.txt | 2.89 KB | Lendude |
#5 | 2405481-5-SHOULDFAIL.patch | 2.54 KB | Lendude |
user_roles_contextual_filter-0.patch | 473 bytes | Lendude | |
Comments
Comment #1
LendudeComment #2
dawehnerSeriously, who reviewed that, before it got in :( ... I would vote to rename it back to "user_roles" and be done with it.
Comment #3
LendudeProblem is that even with the name change this still doesn't work. The name change might not actually do anything, this it all a bit beyond me really. Just wanted to report it and maybe point it in the direction where I thought the break might be.
Comment #4
dawehnerAh mh, well at least let's ensure that we add tests later
Comment #5
LendudeAdded some tests that fail, but I recon should be green when this works as intended.
- Test that the right handler is used (returns the Broken handler at the moment)
- Test that the argument filters the result set (doesn't at the moment)
If I combine the tests with the 'fix', the test results in a fatal error:
Argument 4 passed to Drupal\user\Plugin\views\argument\RolesRid::__construct() must implement interface Drupal\Core\Entity\EntityManagerInterface, none given
I'll look into that next.....
Comment #7
LendudeWell, I actually think I got it.
Updated the tests a bit to test for the right handler. Stuck with the name user__roles_rid because that seemed to be used in some unit tests for this handler as well.
Comment #8
dawehnerHa!
Let's remove the indentation here
It would be nice to have a @see to the actual class.
Okay fine, and helpful, we check the execution, but we don't check the argument title, as the method kind of implies.
Its still sad to have such a plugin ID. If you look at the existing code in
RolesRid
nothing of that is tied to the user__roles table. It would be nice to name it 'user_roles' so, its a generic handler, so let's name it generic.Comment #9
LendudeSo, something like this?
Comment #12
LendudeRerolled.
Comment #13
LendudeComment #16
Lendudefixed in #2493033: Make 'user.permissions' a required cache context
Comment #17
jibran