Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Dec 2012 at 10:45 UTC
Updated:
20 Apr 2019 at 11:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerAs a beginning we could move the rendering into a new method, but for sure, this is not the only thing we should do.
Comment #2
dawehnerLet's get this single part in, as it still appears and is really useful.
Comment #4
dawehner#1: drupal-1876964-1.patch queued for re-testing.
Comment #5
tim.plunkettThis looks okay to me, but I'm not sure why it failed.
Comment #6
dawehner#1: drupal-1876964-1.patch queued for re-testing.
Comment #8
dawehner#1: drupal-1876964-1.patch queued for re-testing.
Comment #10
dawehnerSeriously, everytime another number of non-reproducable test fails?!
Comment #11
dawehner.
Comment #12
dawehnerIt simply doesn't make sense to patch both places, as the first one is about grouping and just the second one about the actual output.
Comment #13
dawehner#12: drupal-1876964-12.patch queued for re-testing.
Comment #14
tim.plunkettWe should probably add a test plugin that uses this. Also, it should likely be protected. Otherwise, I think this is perfect.
Comment #15
dawehnerMaking it protected totally makes sense.
Don't we have general tests for styles already? StyleTest::testStyle() so it seems to be that we just have some internal refactoring here.
What would we test? That the different keys are returned?
Comment #16
tim.plunkettNow that it's protected, its just an internal implementation detail. So no need for dedicated tests.
Comment #17
dawehnerBetter documentation, suggested by @xjm
Comment #18
xjmComment #19
webchickHm. I don't think I'd ever intuit that a method called "renderSingle" had anything to do with groups or grouping without digging into the PHPDoc. Seems like "renderGroup" or "renderSingleGroup" woud be better?
Although, it's kinda weird we need this distinction. render() doesn't generally care whether it's rendering one of something or a nested several of something. You point it at a key and go.
Can more information be provided on why this is necessary?
Comment #20
tim.plunkettWell, Views render() predates the Render API :(

The grouping bit is about this:
Internally, Views always calls render_grouping_sets(), but with only 1 set.
When overriding how a set renders, multiple or not, it will be really useful to have this method split out from the others.
Comment #21
xjmYeah,
renderSingleGroup()might be a better method name.Comment #22
tim.plunkett"Renders a single group of a grouped view." => renderSingleGroup()
@webchick++ @xjm++
Comment #23
damiankloip commentedYep, that definitely makes sense!
Comment #25
tim.plunkettRandom failure
Comment #26
dawehnerI like the new name.
Comment #27
webchickThanks, I think that'll be clearer to people.
Committed and pushed to 8.x. Thanks!
I thought this might need a change notice, and Tim agreed, so moving it to the Views queue.
Comment #28
dawehnerHere is one.
http://drupal.org/node/1957350
Comment #29
xjm@dawehner, I think we should put a snippet of an example D7 style plugin and then a D8 one using this method, so that people can see how much better it is in context.
Comment #30
dawehnerMaybe someone actually finds a good example: All I can find are either incredible complex: calendar, gmap, or do not really something which explains exactly the point of this issue.
Comment #31
xjmWell, the D7 plugin would presumably have overridden and copied all of the equivalent of
StylePluginBase::render_grouping_sets()just to add a little custom code to the group, right? I have painful memories of doing something along those lines in D6 days. So the "pre-change" version (not necessarily D7 I guess, just without the new method) could just have a clone ofrender_grouping_sets()with the additional parameter of your example inside?Comment #32
dawehnerNon of the contrib examples actually have the bits which show the actual problem. All of them have their own complex stuff, and override the grouping mechanism anyway, so they wouldn't really gain from it.
Well, we could just invent a good example.
Comment #33
xjmRight, it doesn't actually need to do anything other than add your
'#additional_parameter' => 'foo'I think.Comment #34
jibranI have updated http://drupal.org/node/1957350 and I also think we need \StylePluginBase::render_grouping_set as well to render single group.
:link => http://drupalcode.org/sandbox/jibran/1867222.git/blob/refs/heads/7.x-1.x...
Just talked to @dawehner on IRC we can add above function to views in D7 I will post the patch soon.
Comment #35
jibranfollow up #1961702: Rename renderSingleGroup to renderRowGroup
Comment #36
xjmThat looks good! Now on to the backport.
Comment #37
jibranD7 patch.
Comment #39
dawehner#37: 1876964-37.patch queued for re-testing.
Comment #40
xjmTitle was driving me crazy. :)
Comment #41
xjmAnd let's respect the followup change too.
Comment #42
jibranCreated #1963420: Improve DX when writing style plugins by adding a groupingTheme variable for #34
Comment #43
chris matthews commentedThe 6 year old patch in #37 to views_plugin_style.inc does not apply to the latest views 7.x-3.x-dev and if still applicable needs to be rerolled.
Comment #44
andrew answer commentedPatch rerolled.