Problem/Motivation
On #2393339: [META] Make sure Views base fields are using Field API for formatting, and do not lose functionality, we are updating all base entity fields in entity views data so that they are using Field API for formatting rather than using generic Views handlers.
This issue is about several fields that are currently using a custom 'user' Views handler from the User module:
- NodeViewsData - uid
- UserViewsData - uid
- CommentViewsData - uid
These should all be able to use the basic 'field' plugin instead, and then this custom 'user' plugin can be removed.
Also, the test coverage in
core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php
should be updated to cover these fields.
Proposed resolution
Change these three fields to use the Field API formatter 'field' instead of the custom formatter. Should also be able to remove the custom formatter from the code base completely.
Remaining tasks
Make a patch.
User interface changes
None.
API changes
Not really.
Comment | File | Size | Author |
---|---|---|---|
#14 | views_plugin_user_replaced_field-2470093-14.patch | 8.26 KB | keopx |
#14 | interdiff-views_plugin_user_replaced_field-2470093-10-14.txt | 450 bytes | keopx |
#10 | interdiff-views_plugin_user_replaced_field-2470093-6-10.txt | 2.46 KB | keopx |
Comments
Comment #1
mpdonadioI'm not assigning myself yet as I have too many issues with my name on them right now, but I can work on this when those get wrapped up (doing a bunch of similar ones), and if nobody else picks this up.
Comment #2
dawehnerI do agree that we should not support linking a UID to its user, unless you configure it for youself in views.
Comment #3
xjmDiscussed with alexpott -- since we put user IDs all over the place (including in cache tags), this one makes sense as a major.
Comment #4
keopxComment #5
keopxComment #6
keopxTest run wrong and I changed values to adding user id and passing correct values to assert
Comment #7
keopxRemoved comment
Comment #9
jhodgdonWow, only one test failure -- that's great!
So. A couple of things to fix on this patch:
a) The 'user' plugin class should be removed in this patch, since it is hopefully not used any more. This is class
Drupal\user\Plugin\views\field\User
b) The test failure... I don't really understand it. The test view config that is being used is in
core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml
For some unknown reason, even in Core this already has the 'uid' field set to be using plugin 'field', and this patch doesn't change that, but the test failure is complaining that plugin 'user' doesn't exist. ??!?
Ah. It thinks that it *depends* on the 'user' plugin... Well, I still don't get it.
Comment #10
keopxComment #11
keopxRemove class
Comment #13
jhodgdonMaybe @dawehner can tell why this fails?
Comment #14
keopxAfter speak with @dawehner pass local test for test fails
Kudos for @jhodgdon and @dawehner
Comment #15
jhodgdonGreat!
I don't see any problems here. I also tested it manually (just in case!) at least for Node views. Works fine.
Comment #16
webchickGreat work! This one looks a lot more straight-forward than the others.
Committed and pushed to 8.0.x. Thanks!