As discussed in #2010930: [META] Apply formatters and widgets to rendered entity base fields (all besides node.title) it is policy to make rendered base fields throughout core configurable through the "Manage form display" UI.
In the case of the comments module, this will take care of many frequently-asked feature requests. This issue is about the Comment entity type's uid, name, mail, homepage and created fields.
#2578741: Add setting for size to email widget was spun off half way through as a dependency of this issue and is already committed.
Making the same change for "Manage display" is being handled in a separate issue #3090187: Mechanism to disable preprocessing of base fields in comment entity type so they can be configured via the field UI.
Remaining tasks
- Rework patch to use, and remove any overlap with, #2578741: Add setting for size to email widget
- Fix test failures.
- Respond to code reviews #105,#106#108
- Create upgrade path & upgrade path tests
- ?"Once test failures are fixed, look into converting more base fields." (may no longer be relevant?)
User interface changes
None.
API changes
None. The comment.subject, comment.mail and comment.homepage base fields are rendered using widgets and formatters, and is no longer exposed as an "extra field".
| Comment | File | Size | Author |
|---|---|---|---|
| #160 | 2227503-160.patch | 30.21 KB | _utsavsharma |
| #160 | interdiff_158-160.txt | 717 bytes | _utsavsharma |
| #159 | interdiff_158_159.txt | 800 bytes | ameymudras |
| #159 | 2227503-159.patch | 30.22 KB | ameymudras |
| #158 | interdiff_156_158.txt | 3.12 KB | ameymudras |
Comments
Comment #1
wim leersComment #2
wim leersThis should actually be done in the widget; so we'll actually need to override the
string: either in a comment module-specific way, or as aDescriptionLessStringWidget… which feels ugly.(Because otherwise there won't be a description in the comment form, but there will be when in-place editing.)
Comment #4
e0ipsoComment #5
berdirFixing those test fails.
Comment #7
berdirFixing the remaining test fails.
The access stuff should be handled through field access, but we're waiting on #2029855: Missing access control for user base fields for that to become easier.
Comment #8
berdirPatches would help.
Comment #9
wim leersAlso did the
mail,homepageandcreatedfields now. Still not everything, but at least we're still moving forward.I didn't fix the tests yet.
Comment #10
wim leers… and now with an actual patch.
Fixing the tests is a great issue for a novice to work on, e.g. at NYC camp.
Comment #12
berdirShould we really care about 60 vs 64 characters? Keeping the current UI is important, but 4 characters more or less really doesn't make much of a difference?
Yeah, I was wondering if we should try to get the new widgets/formatters in separately because node is quite a tough issue. But then we wouldn't have test coverage for them...
Comment #13
segi commentedNeed to reroll.
Comment #14
segi commentedComment #15
segi commentedComment #17
gcb@e0ipso looks like it's been a while, so unassigned, just comment if you want it back!
I'm at NYC Camp sprint right now, so going to have a look and see what I can do with it.
Comment #18
segi commentedOne test fails, because the comment form not posted after submit. I got this error message after submit
"This value should be of the correct primitive type."
I found out that, this row cause the problem:
This field get FALSE value, but I don't have enough experience so I don't have idea what cause the problem.
Comment #19
yched commentedComment #20
lokapujyaThis will fail. It's just the re-roll for now. Applied #8, then manually applied interdiff from #10, and fixed a merge conflict.
Comment #22
lokapujyaFixed at least one test here.
Comment #24
lokapujyaThis needs more than just fixing the tests. When I manually go to :
/comment/reply/node/1/comment
1. I get an AJAX error.
2. When I submit the comment, I get: "This value should be of the correct primitive type."
#2 was introduced by the interdiff in #10.
Comment #25
lokapujyaComment #26
andypostI'm doing conversion of comment subject field in #2292821: Use widget for comment subject field
But my one changes a migration path so probably better to fix subject field here and proceed with migration in the related
Comment #27
andypostHere's a patch for comment subject field only
Comment #28
andypost#2292821: Use widget for comment subject field landed
Comment #29
wim leersNice work, now this patch will become quite a bit simpler!
Any chance you could reroll this patch also? I can provide reviews. (You're already familiar with the latest code base, so it would be easier for you to reroll this than for someone else.)
Comment #30
andypostWrongly filed patches to #2226493-95: Apply formatters and widgets to Node base fields
Initial patch, also converts name field
PS: pushed to github
Comment #32
andypostshould fix reply form
Comment #34
andyposthomepage validation broken somehow (empty homepage does not pass validation via "uri" widget)
Comment #36
andypostanother try
Comment #38
berdirThis won't pass yet, but this is cleaning up a lot of stuff. Also adding access control. uid/name certainly needs more work, we'll see about other things.
Comment #40
berdirFixing some tests.
Most remaining fails are related to uid/name behavior. Not sure yet how to make sense of that.
Comment #42
lokapujyaDo we need this? It gets passed to entity_create().
Comment #43
lokapujyaWill try it.
Comment #45
lokapujyaI was surprised to see more errors. I think it needs to be re-rolled due to: #2287071: Add cacheability metadata to access checks
Comment #46
berdirLets wait on #2098419: Missing default access for all comment fields.
Comment #47
berdirOk, let's see how good the access checks are that were added there :)
Comment #49
berdirComment #50
larowlanCompleted beta phase template in issue summary
Comment #51
larowlanAnd re-rolled whilst at it
Comment #55
andypostInstall works, there's still 2 debug() calls, and form needs some love:

Comment #57
andypostFix few tests, email widget changed (size setting, looks a feature)
Comment #59
penyaskitoRerolled. Conflict was on comment.info.yml, not a big deal.
Comment #61
penyaskitoIf we remove this, there is no author name field for anonymous users.
Comment #62
larowlanDoes that mean we need a new widget?
Comment #63
yched commentedNot a full review, but :
We have to grow a habit of updating config schemas accordingly :-) (field.widget.settings.email_default here)
Comment #64
larowlanre-roll and fixes #63
Comment #65
larowlanpatch would help
Comment #67
larowlanComment #68
larowlanFound #2405675: Comment field settings don't save and #2405691: CommentAccessControlHandler checks for an invalid setting (anonymous_contact) the second of which blocks this
Comment #69
larowlanThis includes #2405691: CommentAccessControlHandler checks for an invalid setting (anonymous_contact)
Comment #70
larowlanComment #71
larowlanForgot to merge
Comment #74
larowlanMore work - this *just* might be green.
Now we have an issue with the admin-user seeing too many fields on the comment-add form (see screenshot).
And anytime we want to change values, we have to submit both uid and name - including when making the comment anonymous (see interdiff).
Also found that the CommentNameValidatorConstraint does a === against 0, but it's actually "0", so added a cast to the Comment::getOwnerId() method (see interdiff).
So we need to decide how to handle the duel fields and what the admin sees I think.
Comment #75
wim leersFirst: AWESOME work!
#2405691: CommentAccessControlHandler checks for an invalid setting (anonymous_contact) landed; so this needs a reroll.
I reviewed the patch, but couldn't find anything to complain about code-wise. However, I don't understand yet why the screenshot in #74 looks so vastly different from the comment form in HEAD? IIRC, in the other "fields & widgets" issues, we succeeded in keeping everything looking exactly the same. Why can't that be done here? (Perhaps you're saying that the next step, but that just wasn't clear to me.)
Comment #76
andypost@Wim #74 explains that there only 2 problems with patch currntly:
1) for UID1 access does apply that's why we see name and uid fields both
2) patch needs some love to properly alter form widgets to keep previous look
shell be done :)
The problem 1) just needs more time
Comment #77
wim leers#76: thanks for the clarification :) If you're stuck on anything, ping me, and I'll try to help!
Comment #78
andypostdiscussed at irc
So
1) default values for fields
2) fix
checkFieldAccess()3) tune-up form
4) check test coverage
Comment #79
jibranComment #80
andypostno interdiff, merged manually
a lot of code gone in comment form
Comment #82
wim leersThanks for pushing this forward again!
Comment #83
andypostFixed tests except
CommentBlockTestno idea why getSubject returns nothingComment #85
andypostHere's few more fixes, still failed tests:
1) subject is not generated from comment body (
CommentBlockTestshows that)2)
CommentTranslationUITestbecause now there's 2 fields (uid and name) still and changing name does not change authorComment #87
wim leersGetting closer! :)
Comment #88
andypostSubject still needs generation, added access for elements
Maybe file separate issue to discuss UI regression - now there's 2 fields Name and Author?
Comment #90
larowlanI thought we resolved in #78 that we could fix that with access handlers?
Comment #91
andypostBut access handlers does not help here because
$is_adminneeds both fields to allow admin change comment to anonymous and set name fieldEDIT commited #2398073: Admin should not be able to edit email of authenticated commenters
Comment #92
siva_epari commentedPatch rerolled.
Comment #93
siva_epari commentedPatch rerolled.
Comment #95
rteijeiro commentedRe-rolled!
Comment #99
segi commentedThe last patch needs to reroll.
Comment #100
segi commentedHere it is the rerolled patch.
Comment #102
wim leersWould be great to still get this done.
Comment #103
larowlanreroll
Comment #105
yched commentedIs that really still needed ? Most of the functionnality about ER fields now lives in core
The problem with code like that is that it hardcodes on the inner structure of the widget. And the field definitions make that widget configurable/changeable in Field UI (->setDisplayConfigurable('form', TRUE);)
Needless hunk, one file less to change ;-)
Comment #106
catchThis is the only thing that concerns me - I think it's probably OK before RC, but it'll break default configuration afterwards. So needs a change record, and might be good to split out to a separate major issue to do quickly.
This needs an upgrade path. Also we'd be removing it again if we do the entity reference ashes scattering. Again that seems fine before RC but trickier afterwards (would really like to minimize update hooks added during RC since more people will run them and less excuses if they break).
Apart from that everything here looks eligible for a minor release, but not a patch release, so my personal opinion is if it gets in before RC then that'd be fantastic, but if it doesn't we'll need to move to 8.1.x.
Tagging RC deadline to reflect that.
Comment #107
catchComment #108
yched commentedAlso :
Shameless plug : that line shouldn't be needed after #2578249: Some e_r fields get the wrong Selection handler
Comment #110
larowlanSpun the schema stuff off into #2578741: Add setting for size to email widget
Comment #111
jonathanshawChanging to 8.1 per #106
Comment #112
jonathanshawComment #113
jonathanshawUnassigned as not recently worked on
Comment #115
lokapujyaComment #116
vprocessor commentedComment #117
vprocessor commentedHello guys,
reroll is ready
Comment #118
vprocessor commentedComment #119
vprocessor commentedComment #122
mohit_aghera commentedRe-rolling patch for 8.3.x
Comment #124
lokapujyaSo $contact should always be an array(). Because later on, on line #134:
Comment #128
andypostComment #129
yogeshmpawarComment #130
yogeshmpawarComplete re-roll of patch #122
Comment #131
yogeshmpawarComment #134
catchThe subject field is using a widget now, but it's not using a formatter, so we should either add that here or spin-off another issue.
Comment #135
anas_maw commentedReroll the patch in #130 to work on latest 8.6.x
Comment #136
larowlanCan we get an issue summary update of the remaining tasks here - I see refs to addressing code reviews in the current remaining tasks - have they been completed?
I also see tags for update path and tests - should we add those to the remaining tasks?
Comment #140
adamps commentedI updated the IS to match the latest patch and to reference new issue #3090187: Mechanism to disable preprocessing of base fields in comment entity type so they can be configured via the field UI which answers #134.
Comment #141
andypostComment #142
sokru commentedJust a reroll with minor coding standard fixes.
Two pointers:
1)
core/modules/comment/src/Entity/Comment.php
on
baseFieldDefinitions()for$fields['uid']with description "The user ID of the comment author" doesn't have anymore:wonder if they should be there. They where removed in #2949964: Add an EntityOwnerTrait to standardize the base field needed by EntityOwnerInterface.
2)
In
core/modules/comment/tests/src/Functional/CommentPreviewTest.phpfunctiontestCommentEditPreviewSave()makes following changebut keeps :
wonder if that's correct?
Comment #147
scorpionghost commentedOriginal: http://xandeadx.ru/blog/drupal/981
Comment #148
vsujeetkumar commentedRe-roll patch crated for 9.3.x.
Comment #149
vsujeetkumar commentedFixed custom command fail issue.
Comment #150
larowlanThere are 200 odd test fails here https://dispatcher.drupalci.org/job/drupal_patches/94678/
Comment #151
andypostComment #152
catchWe should be making the comment title part of the display mode configuration as well so it can be hidden (this used to be configurable via a 'show subject' option but that's no longer in Drupal 9).
Comment #153
jonathanshaw@catch The comment title is being worked on as part of #2353867: [META] Expose Title and other base fields in Manage Display, especially #3090187: Mechanism to disable preprocessing of base fields in comment entity type so they can be configured via the field UI. The complexities are mostly not specific to the entity type.
Comment #156
sahil.goyal commentedrerolling the patch for the Drupal 10.1.x version and made it compatible with the version and made some improvements to the patch, along with the patch attaching the reroll_diff, Please review it and suggest if need to update something.
Comment #157
sahil.goyal commentedComment #158
ameymudras commentedComment #159
ameymudras commentedFixing the CCF
Comment #160
_utsavsharma commentedTried to fix CCF.
Please review.
Comment #161
smustgrave commentedSeems to be having failures going back to #148
Also was previously tagged for upgrade path and upgrade test which still need to happen
Did not test issue.