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
we make several base fields to use just Entity field formatters and not special purpose field handlers in views. However, we have a lot of other field handlers in views that have more functionality than the corresponding field formatters.
Proposed resolution
Replace comment_username with field formatter
Remaining tasks
create patch
User interface changes
Entity fields will have more formatting options available, and they'll be consistent with what is available in Views.
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#29 | interdiff.txt | 1.71 KB | rteijeiro |
#29 | comment-username-views-2454163.29.patch | 12.65 KB | rteijeiro |
#24 | comment-username-views-2454163.24.patch | 11.71 KB | geertvd |
#24 | interdiff.txt | 1.33 KB | geertvd |
#19 | comment-username-views-2454163.19.patch | 11.86 KB | larowlan |
Comments
Comment #1
kgoel CreditAttribution: kgoel commentedComment #2
bburgWorking on this at Drupal4Gov code sprint Co-Sponsored by Forum One ;)
Comment #3
xjmComment #4
jhodgdonThis issue is critical as per parent issue.
Comment #5
dawehnerLet's remove the assignment, as it might block people from working on it.
Comment #6
dawehnerehem, nearly.
Comment #7
geertvd CreditAttribution: geertvd commentedComment #8
jhodgdonDid we really need a special formatter for this? I would think the standard formatters that were previously available would have worked. What options/formatting was missing?
Comment #9
dawehnerThe feature, which is not provided is the special logic for the anonymous user. For them, we get the username from the manually entered
username in the comment form, there is simply no formatter for that yet.
Comment #10
dawehnerThank you @geertvd!
I think we will need a test though ... :)
Comment #11
geertvd CreditAttribution: geertvd at XIO commentedComment #12
dawehnerIdeally we should remove the full entry of
views.field.comment_username
Note: #2454163: Replace comment_username handler with generic views handler should better use those tools.
Note: Also this code should probably not always create an issue, but instead use the author if the author is not the anonymous one.
It would be great to add a newline.
Comment #13
geertvd CreditAttribution: geertvd at XIO commentedThanks for the help, this one actually works :)
Comment #14
geertvd CreditAttribution: geertvd at XIO commentedI'll work on some tests next.
Comment #15
larowlanI think the default is field, so this line can go
should be the ID, i.e. 'comment_username'?
Comment #16
larowlanWorking on tests
Comment #17
larowlanMy first patch in over a week...
Comment #18
larowlanThink we need cache tags too?
Comment #19
larowlanAnd we need to limit the availability.
Comment #20
andypostPatch could have conflict with related
Comment #21
dawehnerCan we add a todo for the issue I linked in the different comment?
IMHO we should also check for the entity type.
Comment #22
geertvd CreditAttribution: geertvd at XIO commentedWhich issue are you referring to? You linked to this ticket in #12
Comment #23
dawehnerEhem sorry, #2458817: Creating new user entities for anonymous users is very slow is it.
Comment #24
geertvd CreditAttribution: geertvd at XIO commentedcomment_prepare_author
can be replaced with$comment->getOwner()
when #2458817: Creating new user entities for anonymous users is very slow is fixed again.Added the check for entity type.
Comment #25
dawehnerAwesome, do you mind adding a follow up for replacing that, once the other issue is in?
Comment #26
dawehnerNote: this does not need tests:
Comment #27
alexpottI think CommentViewsFieldAccessTest needs updating to cover this too - see #2462589: Provide test coverage for access checking of all views fields.
Comment #28
geertvd CreditAttribution: geertvd at XIO commented#2458817: Creating new user entities for anonymous users is very slow just got fixed so we should replace
comment_prepare_author
with$comment->getOwner()
in this ticket.Comment #29
rteijeiro CreditAttribution: rteijeiro commentedAddressed #27 (I guess) and #28.
Comment #30
dawehnerIn indeed does!
Comment #31
alexpottThis issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 6a7d1bb and pushed to 8.0.x. Thanks!