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.
Comment | File | Size | Author |
---|---|---|---|
#31 | 1843762-31-views-view-summary.patch | 4.14 KB | joelpittet |
#31 | interdiff.txt | 935 bytes | joelpittet |
#28 | interdiff.txt | 4.6 KB | joelpittet |
#28 | 1843762-28-views-view-summary.patch | 4.05 KB | joelpittet |
#24 | 1843762-24-views-view-summary.patch | 4.43 KB | shrop |
Comments
Comment #1
joelpittetNeed to deal with this in a nicer way:
{{ row_classes[id] }}
Can someone point me in the right direction?
Comment #2
mbrett5062 CreditAttribution: mbrett5062 commentedTagging.
Comment #3
joelpittetMoving to core queue
Comment #4
joelpittetConversion and cleanup from #1, fixed $vars to $variables, extra whitespace between
$var =
declarations. And docblock cleanups.Comment #5
intergalactic overlords CreditAttribution: intergalactic overlords commentedit prints out an empty class on the links. This is the outputted code:
Comment #6
intergalactic overlords CreditAttribution: intergalactic overlords commentedthis is in the frontend, in the backend, in the views administration, I have a class views-ajax-processed-processed
Comment #7
intergalactic overlords CreditAttribution: intergalactic overlords commentedWhen I change row_classes[id] to row_classes.id in views-view-summary.html.twig it seems to work. The frontend shows no class (not even an empty one). In the backend the views-ajax-processed-processed is still there.
Comment #8
joelpittet@intergalactic o... thank you for reviewing:) Here's a couple changes that make it, look prettier from twig and html.
Comment #9
joelpittetwoops
Comment #10
star-szrTagging.
Comment #11
joelpittetComment #12
dawehnerThis seems to be nearly perfect.
Unneeded space
I guess we can reference the preprocess function.
Comment #13
thedavidmeister CreditAttribution: thedavidmeister commentedYup, as per #12 need to remove trailing spaces on the end of lines.
Twig templates should have @see referencing their preprocess functions, eg:
I'd also like to see some more documentation around the contents of each row in the template, like what are row.url, row.attributes, row.link?
They're all used in the new template without explanation.
Comment #14
joelpittet@thedavidmeister Thanks for the review! For the extra docs for the conversion we are doing @todo if we aren't sure, but I gave it a crack anyways... if there are gripes on what I put, I will re-roll it with @todos. As the extra documentation may need to happen after conversion and probably by people who know better what the variables actually represent.
Got the bits from #12 and #13
Thank you too @dawehner!
Comment #15
joelpittetComment #16
thedavidmeister CreditAttribution: thedavidmeister commented+ * Prepares variables for printing a single record from a row, with fields.
Elsewhere I saw Cottser saying these are supposed to end in "templates." so maybe this should read: "Prepares variables for Views row, single record templates." or something... It's hard to phrase that without being awkward.
+ * - view: The view object.
The View object (capital V).
@todo is fine by me for variables but they were completely absent before, I like what you did in #14.
Other than tweaks, we need manual testing instructions in this issue summary and for somebody to do the testing now.
Comment #17
star-szrRegarding #16, for the more complex descriptions it's fine to break up the description between the summary and a paragraph after. e.g.:
Making the documentation tweaks noted here and creating a new patch and interdiff would make a good novice task.
If you'd like to work on this, please assign the issue to yourself. If you get stuck, drop by #drupal-twig on IRC or post your questions here. Thanks!
Edit: added context to docs example.
Comment #18
joelpittetFixes from #16 and #17 thanks @thedavidmeister and @Cottser
Comment #19
shrop CreditAttribution: shrop commentedThe markup before and after patch in #18 match. The Twig version works as expected in my manual testing.
Before:
After:
Comment #20
thedavidmeister CreditAttribution: thedavidmeister commentedDocs nitpick:
+ * - options.count: A views option for whether to show the count.
+ * - rows: The rows contained in this view.
Capital V for View(s).
Comment #21
Albert Volkman CreditAttribution: Albert Volkman commentedDocs fixed.
Comment #22
thedavidmeister CreditAttribution: thedavidmeister commented+ * - rows: The rows contained in this view.
Capital V for View.
Comment #23
joelpittetThe "row." doesn't need to be there on these lines. The object "row" is not a key it's somewhat arbitrary inside the loop. Please remove these:) The indent does the talking.
Comment #24
shrop CreditAttribution: shrop commentedThe attached patch addresses the code comment changes requested in #22 and #23.
Comment #25
dawehner+1
Same comment as before: there is rows and result in there, and the documetation of the view objection should be improved. (see #1843766: Convert views/templates/views-view-table.tpl.php to twig)
Comment #25.0
dawehneradded main meta
Comment #26
thedavidmeister CreditAttribution: thedavidmeister commentedNitpick:
+ * - rows: The rows contained in this View.
We'd generally add something like "Each row contains:"
+ * - options.count: A Views option for whether to show the count.
What's the point of this being options.count when we could just have a "display_count" flag. Is the "options" variable doing anything else at all? If so, why isn't anything else in options documented?
Comment #27
star-szrTagging for profiling.
Comment #28
joelpittet@thedavidmeister re #26 Options.count is how they did it before, not sure I want to make that change in this conversion? Maybe you can open a separate issue for that one?
I reverted $variables => $vars to make the conversion more clear. Also I have split that one out here: #1963942: Change all instances of $vars to $variables
I reverted my $row_classes to $row['attributes'] conversion as well and separated that out here: #1968398: Convert Views $row_classes to $row['attributes']
And did the V to v on views.
Comment #29
thedavidmeister CreditAttribution: thedavidmeister commented#28 - that makes sense, I've now seen the options.foo variable around in a few other patches. This one is just the only one with a single option so it threw me a bit.
What about this, we extend the docs a bit to use the indented form rather than foo.bar syntax?
+ * - options.count: A views option for whether to show the count.
Could be something like:
Comment #30
thedavidmeister CreditAttribution: thedavidmeister commentedas per #1843764: Convert views/templates/views-view-summary-unformatted.tpl.php to twig, what about "Flags indicating how the summary should be displayed."?
Comment #31
joelpittetHow does this work for #29 and #30?
Comment #32
thedavidmeister CreditAttribution: thedavidmeister commentedlooks good, was manually tested in #19
Comment #33
tlattimore CreditAttribution: tlattimore commentedI will work on profiling this.
Comment #34
tlattimore CreditAttribution: tlattimore commentedPerformance benchmarks on this look pretty good in my opinion. Here are the results (with APC class loader not enabled):
Run 519c153c76aa0 uploaded successfully for drupal-perf-drupalcon.
Run 519c1639640b3 uploaded successfully for drupal-perf-drupalcon.
=== 8.x..8.x compared (519c153c76aa0..519c1639640b3):
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c153c76aa0&...
=== 8.x..1843762-views-view-summary compared (519c153c76aa0..519c1681d41e5):
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c153c76aa0&...
Comment #35
thedavidmeister CreditAttribution: thedavidmeister commentedmmm, 0.7% is a little bit on the high side as far as these conversions go. They're usually sitting at 0.2-0.6%.
Comment #36
star-szrThat's with APC cache off. I think this is fine.
Comment #37
alexpott+1. Ready for #1987510: [meta] Convert all core *.tpl.php templates to Twig as singular patch
Comment #38
alexpottCommitted 80cb1e4 and pushed to 8.x. Thanks!
Comment #39.0
(not verified) CreditAttribution: commentedUpdated issue summary.