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
In case someone has the idea to override CommentViewBuilder, it is basically just impossible without overring everything, as CommentViewBuilder and self
hardcodes the used classed. Both references should be replaced by static, so you can easily have a CustomCommentViewBuilder extends CommentCommentViewBuilder.
Related: https://www.drupal.org/node/2342683 (it is the same case)
Comment | File | Size | Author |
---|---|---|---|
#17 | 2348547-followup.1.patch | 1.13 KB | larowlan |
#7 | comment-2348547-6.patch | 1.7 KB | tim.plunkett |
#4 | comment-2348547-4.patch | 1.81 KB | tim.plunkett |
#1 | 2348547-CommentViewBuilder_should_use_static_where_possible-2.patch | 1.63 KB | estoyausente |
Comments
Comment #1
estoyausenteComment #2
larowlanComment #3
larowlanTwo of these will fail, can't use static in string callback
Comment #4
tim.plunkettIt's a little shortsighted of #post_render_cache to key by the $callback, since normally we'd use an array for this. Trying concatenating instead.
Comment #7
tim.plunkettAhh, drupal_render_cache_generate_placeholder does not support callables either, only strings.
Comment #8
larowlanLets just move this to the service (CommentPostRenderCache) where we can have real DI an no \Drupal and then it can be swapped/subclassed easily
+1
Comment #9
estoyausenteHi, thanks for the patch correction. It's enough for me now :-)
Comment #10
larowlan8.1 can be followup
Comment #11
larowlan#2350273: Move CommentViewBuilder::renderLinks post_render_cache callback to CommentPostRenderCache
Comment #12
alexpottCommitted bc20bd5 and pushed to 8.0.x. Thanks!
Comment #14
tstoecklerDon't we really want get_called_class() here instead of get_class()?
Comment #15
tim.plunkettUm, yeah we do. Either get_called_class() or get_class($this)
Comment #16
dawehnerYeah, see http://3v4l.org/E6Cjk
Comment #17
larowlan/me didn't even know of that function - thanks
Comment #18
dawehnerCool
Comment #19
larowlantrivial patch of the month?
Comment #20
alexpottCommitted 6d5e445 and pushed to 8.0.x. Thanks!