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 |
---|---|---|---|
#68 | 1843748-68.patch | 5.78 KB | Hydra |
#60 | 1843748-60.patch | 5.78 KB | star-szr |
#60 | interdiff.txt | 1.22 KB | star-szr |
#59 | 1843748-52-57.patch | 5.7 KB | geoffreyr |
#59 | 1843748-52-57.interdiff.txt | 1.85 KB | geoffreyr |
Comments
Comment #1
joelpittetstripped out of meta patch, first draft
Comment #2
joelpittetComment #3
mbrett5062 CreditAttribution: mbrett5062 commentedTagging.
Comment #4
FluxSauce CreditAttribution: FluxSauce commentedCommitted and attributed, thanks!
Comment #6
joelpittetMoving to core queue
Comment #7
tlattimore CreditAttribution: tlattimore commentedThis is a straight re-roll of @joelpittet's patch in #1 against 8.x HEAD and deleted the corresponding .tpl.php.
Comment #8
joelpittet@tlattimore thanks, it passed!:) Could you clean up the
$vars
to$variables
in the preprocessor? And the preprocessor docs?Comment #9
joelpittetComment #10
tlattimore CreditAttribution: tlattimore commentedHere is an updated patch that includes the requested changes joelpittet mentioned in #8.
Comment #11
star-szrTagging.
Comment #12
thedavidmeister CreditAttribution: thedavidmeister commentedReview for #10:
Twig templates need
@see template_preprocess()
,template_preprocess_views_view_fields()
and@ingroup themeable
.{% if field.separator is defined %}
Can we do away with "is defined"?
Is var_export something people will be doing inside a Twig template? I think we could drop that from the comment.
The preprocess looks good to me, the only thing it's really changing is $vars to $variables.
I think this is just about ready for manual testing of the markup though, these changes are pretty minor.
Comment #13
star-szrThanks @thedavidmeister! A couple more tiny tweaks:
Prepares variables for … templates (plural templates) per #1913208: [policy] Standardize template preprocess function documentation.
The 'Default template' line should end in a period.
If we're only changing $vars to $variables in the preprocess, let's wait until #1963942: Change all instances of $vars to $variables to do that and only update the docblock (roll back the vars -> variables changes). As for the separator, I don't see any need for 'is defined' here.
The tweaks in #12 and here would make a good novice task, tagging.
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!
Comment #14
tlattimore CreditAttribution: tlattimore commentedHere is a patch that makes the changes requested in #13, #12, and also some other minor doc changes.
Comment #15
tlattimore CreditAttribution: tlattimore commentedTagging for review.
Comment #16
jenlamptonWe need to remove mention of complex data structures in templates. How about "A list of fields, each one contains:"
I notice this patch also contains the change from $vars to $variables, which will make the patch in #1963942: Change all instances of $vars to $variables fail. In other views conversions we've been leaving those alone, so for consistency the change should probably be rolled-back here.
Comment #17
tlattimore CreditAttribution: tlattimore commentedHere is a patch that makes the changes requested in #16. Switching $variables back to $vars & the doc change.
Comment #18
tlattimore CreditAttribution: tlattimore commentedtagging
Comment #19
thedavidmeister CreditAttribution: thedavidmeister commented#16, #17 - The reason that linked issue is postponed is so that we don't have to reroll all the conversion patches.
We're expecting the patch in #1963942: Change all instances of $vars to $variables to need re-rolling when the Twig conversions land.
Comment #20
thedavidmeister CreditAttribution: thedavidmeister commented+ * - field.raw: The raw data for the field, if it exists. This is NOT output safe.
+ * - field.wrapper_prefix: A complete wrapper containing the inline_html to use.
Comments longer than 80 characters.
+ * - view: The view object.
Need a capital V for View.
I think "them" and "displayed" are supposed to be indented more, aren't they?
These two lines look like a mistake, is it supposed to be a single dot point?
+ * - row: An array containg information about the current row.
"containg" is not a word.
Comment #21
tlattimore CreditAttribution: tlattimore commentedHere is a patch that makes the doc changes requested in #20.
Comment #22
star-szrQuick review :)
Thanks for all your work on this issue @tlattimore!
Since 'field' is the loop variable used in the template and could be called anything, we shouldn't use 'field' in the docs here.
Something like:
Can we remove this if? I don't see why we need it.
The list is indented by two spaces too many, see http://drupal.org/node/1354#lists.
Edited to fix tags.
Comment #23
tlattimore CreditAttribution: tlattimore commentedThanks for the feedback again, Cottser. Here is an updated patch that makes the changes requested at by Cottser in #22.
Comment #24
tlattimore CreditAttribution: tlattimore commentedgah! tagging.
Comment #25
skt CreditAttribution: skt commentedI've applied the patch & tested the recent comments block display. Text added to the twig template file did not appear (caches flushed from UI).
Comment #26
designfitsu CreditAttribution: designfitsu commentedManually tested the patch from #23:
Also tested the recent comments block as per #25.
Markup matches other than whitespace.
Before:
After:
Comment #27
designfitsu CreditAttribution: designfitsu commentedRemoving manual testing tag.
Comment #28
thedavidmeister CreditAttribution: thedavidmeister commentedI was going to mark this as RTBC but I noticed that there's a few references to "objects" in the Template documentation and we're not using PHP data types in Twig templates.
Comment #29
shanethehat CreditAttribution: shanethehat commentedComment #30
star-szrMore documentation nitpicks:
to *display* all the fields?
Capitalize 'ID'.
These sentences need to start with a capital letter per http://drupal.org/node/1354#drupal.
Re-wrap please :)
This could use some better wording.
@ingroup themeable instead of @ingroup views_templates please.
I think this should be lowercase 'views' and 'view'.
Comment #31
shanethehat CreditAttribution: shanethehat commentedComment #32
thedavidmeister CreditAttribution: thedavidmeister commented@Cottser - this is for you #1992358: [Policy] Decide on capitalisation of the "v" in "view(s)" when talking about views objects/module in documentation :)
Comment #33
thedavidmeister CreditAttribution: thedavidmeister commentednitpick:
I'm not sure that the phrase "squishing up next to each other" is friendly for users that don't speak English as a first language. It wasn't in the original documentation, could we just say "to keep them visually distinct." or "keep them separated."?
Other than that, this looks RTBC to me :)
Comment #34
star-szrTagging for profiling.
Comment #35
widukind CreditAttribution: widukind commenteddealing with nitpickery...
Comment #36
widukind CreditAttribution: widukind commentedlast patch from comment #31 does not apply anymore, rerolling.
Comment #37
widukind CreditAttribution: widukind commentednevermind comment #36. the patch does apply. back to tweaking the comments as requested in #33.
Comment #38
widukind CreditAttribution: widukind commentedfixed typo while at it.
Comment #39
thedavidmeister CreditAttribution: thedavidmeister commentedGreat, and we have done manual tests for this already.
Comment #40
star-szrMore docs/coding standard tweaks, then back to RTBC:
s/themable/themeable/
These asterisks in the docblock should all line up, the lines starting at '- view' and ending at '- row' need another space before the asterisk.
Comment #41
c4rl CreditAttribution: c4rl commentedImprovements from #40
Comment #42
star-szrMuch better, thanks @c4rl!
Comment #43
geoffreyr CreditAttribution: geoffreyr commentedProfiling.
Comment #44
jerdavisForgot to assign this to myself. I just ran a profile on this one, results not great.
Scenario
* Convert front page view to fields from content
* Front page view shows title and body
* 50 nodes generated with devel generate
* Full node view block displaying one node placed on front page
Comment #45
geoffreyr CreditAttribution: geoffreyr commentedMy results weren't particularly good either.
Scenario:
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c116ac5313&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c116ac5313&...
Comment #46
tlattimore CreditAttribution: tlattimore commentedRemoving "Needs profiling" tag.
Comment #47
jerdavisShould this one be bumped to needs work or some other status given the results of profiling?
Comment #48
thedavidmeister CreditAttribution: thedavidmeister commentedComment #49
star-szrPlease re-profile this one so we can get some more data.
Comment #50
star-szrRe-profiled with the same scenario as #45:
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519de1c349c58&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519de1c349c58&...
Comment #51
Fabianx CreditAttribution: Fabianx commentedThe 33ms overhead can be seen here:
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?symbol=__TwigTempla...
getAttribute with 20 ms here is more overhead than usual, because it is dealing with objects.
twig_render_var is slightly slower, but within normal what we had seen.
getContextReference is not slow, but called a lot.
Two ways to go:
* a) Create a special "mode" within twig to directly generate syntax to drill down into objects and never use any references. (that would remove almost all of the overhead, but one would need to use this "high-performance" mode).
* b) Or we accept that syntactical sugar costs 5% in this case, but to make core not any slower, we add a theme_ function for views-view-fields.html.twig and have the theme function be used by default like views-view-field.html.twig and field.html.twig.
Most users would not need to override this anyway, so a theme function is probably the best solution short term and would also help overall Drupal performance.
Comment #52
star-szrJust removing an unneeded change from the preprocess function, which was the removal of a blank line.
Comment #53
joelpittetRe: #51, I am partial to 'A', a high performance mode is interesting idea and I would even say that would be default. Sure show()/hide() have their use-cases but I would venture to guess they are not common and most themers don't take advantage of those regularly. Would love to hear others opinion though.
Comment #54
thedavidmeister CreditAttribution: thedavidmeister commented+1 for b in #51. I'm personally not a fan of using templates to achieve a loop of simple tags or are themselves basically a simple tag that usually gets called in a loop - in these cases the template isn't making anything "clearer" or "easier" for themers, it's there "just in case".
Comment #55
thedavidmeister CreditAttribution: thedavidmeister commentedwait... I like both options. The options don't seem to be mutually exclusive in any way.
Comment #56
Hydra CreditAttribution: Hydra commented@rcaracaus and I rerolled, moving the stuff from the template to a theme function. Maybe we need to add some more documentation on this.
Comment #57
rcaracaus CreditAttribution: rcaracaus commentedI just added a doc block for the theme_ function to look more like similar functions in core.
Comment #58
geoffreyr CreditAttribution: geoffreyr commentedRe-rolled changes from 52-57 into one patch.Disregard this one, left some cruft in there from older patches.Comment #59
geoffreyr CreditAttribution: geoffreyr commentedUpdated patches from 58.
Comment #60
star-szrProfiling results are in, and of course the theme function is faster than the .tpl.php file.
Attached patch updates docs and uses $variables for the theme function param.
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519f012418c24&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519f012418c24&...
Comment #61
joelpittetLooked through and that code looks solid, nice work guys!
Comment #62
Fabianx CreditAttribution: Fabianx commentedOkay, I changed the scope of #1815250: Type twig variables in PHP and remove superfluous render_var() and getAttribute() calls from the generated code to include typing objects for faster performance, so the followup for this is created as well.
+1 for RTBC
Comment #63
alexpottNeeds a reroll
Comment #64
alexpottNeeds a reroll
Comment #65
Hydra CreditAttribution: Hydra commentedLet's a go, Mario!
Comment #66
TommyK CreditAttribution: TommyK commentedComment #67
TommyK CreditAttribution: TommyK commentedOops, hadn't refreshed my page, didn't mean to steal that! go on with your work!
Comment #68
Hydra CreditAttribution: Hydra commentedReroll, no interdiff, because basiclly nothing changed
Comment #69
tlattimore CreditAttribution: tlattimore commentedI will review this.
Comment #70
tlattimore CreditAttribution: tlattimore commentedI can confirm that the patch in 68 applies cleanly and works as described. RTBC if it the testbot goes green.
Comment #71
tlattimore CreditAttribution: tlattimore commentedHmmm. This was 2 hours ago that the test request was sent and I am not sure why the test hasn't run yet? And since it hasn't run yet there isn't the link to re-queue it for re-testing...
Comment #72
socketwench CreditAttribution: socketwench commentedI suspect testbot is just overloaded. There's a huge number of people here at DrupalCon.
Comment #73
alexpottCommitted dc98af8 and pushed to 8.x. Thanks!
Comment #74.0
(not verified) CreditAttribution: commentedUpdated issue summary.