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.
Form HTML for the comment form is per user (at least the token + uid on the comment form, plus whatever hook_form_alter() does). This is going to break if render caching is enabled for comments/nodes at the moment.
We might want to postpone this on the comment settings as field patch - that one doesn't fix this issue but it's likely to conflict a lot.
Comment | File | Size | Author |
---|---|---|---|
#29 | interdiff.txt | 1.48 KB | Wim Leers |
#29 | followup_comment_form_breaks_render_cache-2099133-29.patch | 2.6 KB | Wim Leers |
#26 | followup_comment_form_breaks_render_cache-2099133-26.patch | 2.57 KB | Wim Leers |
#15 | comment_form_breaks_render_cache-2099133-15.patch | 2.72 KB | Wim Leers |
#8 | interdiff.txt | 1.9 KB | Wim Leers |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedUnblocked as comments are now a field.
Comment #2
xjmComment #3
Wim LeersMore accurate title.
Comment #4
Wim LeersThis is now blocked on #2118703: Introduce #post_render_cache callback to allow for personalization without breaking the render cache.
Once that is in, this patch solves this issue.
Comment #5
amateescu CreditAttribution: amateescu commentedWhat's with all the drama here?
Comment #6
Wim LeersWell, 99% of people won't realize the harm that comes with having the comment form on the same page. I figured it might be worthwhile to mention that explicitly.
However, if reviewers don't think that's a good idea, I don't mind removing that :)
Comment #6.0
Wim LeersUpdated issue summary.
Comment #7
Wim LeersReroll to track changes in other patch at #2118703-28: Introduce #post_render_cache callback to allow for personalization without breaking the render cache. The code has become much simpler :)
Comment #8
Wim Leers#2118703: Introduce #post_render_cache callback to allow for personalization without breaking the render cache got committed, which means this issue is now unblocked, yay! :)
Reroll to ensure it applies cleanly, and to s/
comment_insert_form()
/comment_replace_form_placeholder
/, which better communicates what the#post_render_cache
callback function does.Comment #9
amateescu CreditAttribution: amateescu commentedDon't forget about the "Beware!" stuff. A user facing text like that has no place for being in core :) .. or you might as well change it to "Here be dragons!" or something like that.
Comment #11
Wim Leers8: comment_form_breaks_render_cache-2099133-8.patch queued for re-testing.
Comment #13
Wim Leers8: comment_form_breaks_render_cache-2099133-8.patch queued for re-testing.
Comment #14
Wim LeersComment #15
Wim LeersThis reroll is identical to the patch in #8, it only removes the "Beware" message amateescu did not like. Could not think of better wording, so it's better to omit it.
(No interdiff because I just removed that hunk from the patch.)
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commentedCode looks great, and the last patch came back green so most recent one should do so as well.
Comment #17
amateescu CreditAttribution: amateescu commentedThanks!
Comment #18
andypost+1 to patch, suppose no reason to have tests for this kind of render cache
Comment #19
Wim Leers#18: there is *extensive* test coverage in #2118703: Introduce #post_render_cache callback to allow for personalization without breaking the render cache for
#post_render_cache
. More importantly: existing integration tests don't need to be modified, so we already have test coverage.Comment #20
msonnabaum CreditAttribution: msonnabaum commentedYeah, this looks good to me as well.
Comment #21
catchNo complaints here either. Committed/pushed to 8.x, thanks!
Comment #22
Wim LeersComment #23
yched CreditAttribution: yched commentedCould we make comment_replace_form_placeholder() a static method on CommentDefaultFormatter instead ?
Comment #24
Wim Leers#23: not yet, because
#post_render_cache
does not yet support object methods, for the reasons outlined at #2118703-42: Introduce #post_render_cache callback to allow for personalization without breaking the render cache. Rest assured that if it becomes possible, I will happily get rid ofcomment_replace_form_placeholder()
.Comment #25
tstoecklerRe #23/#24:
As call_user_func_array() is used to call the callbacks, I would have thought that static class methods are in fact support by #post_render_cache. Because $callback is used as an array key, what is not supported is array($object, 'method') but I don't see a reason statics like 'Drupal\foo\ClassName::staticMethod' shouldn't be supported. I might be wrong, though.
Comment #26
Wim Leers#25: you're absolutely right. This is much better.
Thanks, yched & tstoeckler!
Comment #27
tstoecklerAwesome, thanks! Unless the bot objects this is RTBC.
Comment #28
amateescu CreditAttribution: amateescu commentedMissing the leading '\'.
Comment #29
Wim LeersAddresses #29 and improves a comment.
Comment #30
tstoecklerWe're very inconsistent with this in core currently, so I'm not marking back to "needs work", but on a general note our current coding standard is:
(Not advocating that that standard is a good thing, but it's our curent standard.)
Comment #31
amateescu CreditAttribution: amateescu commentedUps, didn't know about that, sorry. But since we're inconsistent anyway, this can be a novice task to fix all over core.
Comment #32
Wim LeersHah, so that's exactly what I was thinking: none of our
use Some\Crazy\Namespace\Class
statements also omit a leading backslash.Comment #33
catchThis would've been better in a normal follow-up issue - easier to follow later on. But committed/pushed to 8.x, thanks!
Comment #34
Wim LeersSorry: I wasn't sure what was preferred. Will do so in the future!
Comment #35
xjmRetroactively tagging beta blocker as a blocker for #2151459: Enable node render caching.
Comment #36
Wim LeersRetroactively marking critical: a blocker to a critical issue should itself be critical, and this blocked #2151459: Enable node render caching, which is critical.
Comment #37
andypostThis one already fixed, any reason to mark it?