Skip to content

Instantly share code, notes, and snippets.

@steveoliver
Created June 27, 2013 19:18
Show Gist options
  • Select an option

  • Save steveoliver/5879504 to your computer and use it in GitHub Desktop.

Select an option

Save steveoliver/5879504 to your computer and use it in GitHub Desktop.
Discussion between steveoliver and Fabianx on the topic of Twig variable drillability.
***: Buffer Playback...
Fabianx: [15:17:27] steveoliver: pong
Fabianx: [15:17:50] steveoliver: Can you pass me the link to drill able again (sorry during moving, not much time left  )
***: Playback Complete.
steveoliver: 2008450
Druplicon: https://drupal.org/node/2008450 => Provide for a drillable variable structure in Twig templates [#2008450] => Drupal core, theme system, major, needs work, 12 comments, 10 IRC mentions
steveoliver: Fabianx: ^^
Fabianx: steveoliver: So implementation is:
Fabianx: ( proof-of-concept)
Fabianx: * Add a new parameter to render and theme.
Fabianx: Call it $render = TRUE
Fabianx: If $render == FALSE, call theme(..., $render), but do not run the actual theme function but return the $variables array.
scor: what levels of expertise is recommended for joining the hang out calls on Thu - is it for hard code Twig wizards or is it for newbies willing to tackle the low hanging fruit D8 issues?
tlattimore: scor: I would say if's for anyone who want's to be involved in Twig
steveoliver: tlattimore++
steveoliver: what he said ^^
Fabianx: Add some code in the d_render() for the case that $render == FALSE and replace the internal structure of the processed element with $variables and save the original in #original.
Fabianx: Do not call post_process or render_children if $render == FALSE.
Fabianx: or drupal_wrapper
Fabianx: or #prefix or #suffix.
Fabianx: That is all ignored for drillability.
boze_ left the room (quit: Quit: ((_(__(___(____(_____)____)___)__)_))). (12:32:11 PM)
steveoliver: …sure
Fabianx: Then when you are able to get a structure from render()
Fabianx: Like:
steveoliver: i get that part..
steveoliver: so up to the determination point for $render = TRUE/FALSE...
steveoliver: you still see that happening on TwigTemplate::getAttribute()
steveoliver: ?
Fabianx: $vars = render( array( '#theme' => 'x', ...), FALSE);
steveoliver: but why not create a separate function, i..e dont_render()...
steveoliver: and leave render alone...
Fabianx: steveoliver: That would be rather slow and its really only needed for render arrays.
Fabianx: steveoliver: That is fine.
steveoliver: sure
Fabianx: steveoliver: Just for theme() it probably makes sense (for a POC) to not copy all code ...
mamoun: is there something I can help in here, from time to time I try to do something in twig initiative but there is so many things to read and I don't have much time
steveoliver: i'm cool with that stuff...
Fabianx: steveoliver: For #types I would say they should define a "drillable_function" as part of their type definition.
Fabianx: For themes use the $variables.
steveoliver: *thinks on that....*
steveoliver: well wouldn't the drillable function just be preprocess?
Fabianx: steveoliver: ( would at least solve it for links for now )
Fabianx: steveoliver: yes
Fabianx: steveoliver: but _especially_ the types we want drillable.
Fabianx: link as the prime example.
mamoun is now known as artofeclipse (12:36:14 PM)
Fabianx: steveoliver: So the thing to pass the tests then is to use the TwigReference::__get function.
Fabianx: because all render arrays (at least for printing) are passing through there.
Fabianx: So that is ideal to intercept there.
paulhhowells_ [~paulhhowe@i-83-67-223-149.freedom2surf.net] entered the room. (12:37:19 PM)
pixelwhip [~Adium@203-213-23-164.static.tpgi.com.au] entered the room. (12:37:34 PM)
steveoliver: ok. jumping back a second: re: *suggestions, *suggestions_alter, *prepare, *prepare_alter…, i doubt that will happen… what do you think?
steveoliver: i wondered about it because calling prepare and prepare_alter would seem the only things needed in our 'dont_render' function ...
Jennifer Lampton: steveoliver: suggestions + suggestions alter can happen pretty easily
Jennifer Lampton: prepare might have to remain preprocess for D8
steveoliver: jenlampton: cool
Jennifer Lampton: sadly 
Jennifer Lampton: I think we'd need a new meta that was "split preprocess into prepare and prepare alter" with a critical follow up to remove preprocess
Jennifer Lampton: we just need to determine how crucial that is for everything else we need to do
Jennifer Lampton: but since there's been no momentum there yet
Jennifer Lampton: *shrugs*
steveoliver: yeah, but the bug needs fixed
steveoliver: Le Bug
steveoliver: specific preprocess functions for theme_suggestions are not called...
steveoliver: k, i gotta jump offline for a few, but ZNC will stay online to catch any messages for me..
steveoliver: Fabianx++
steveoliver: jenlampton++
Jennifer Lampton: the twigterns are coming today 
Fabianx: I think https://drupal.org/node/1898474 is needing one more round of manual testing and then is RTBC.
steveoliver: Tues/Thurs, is that rihgt?
Druplicon: https://drupal.org/node/1898474 => pager.inc - Convert theme_ functions to Twig [#1898474] => Drupal core, other, normal, needs review, 49 comments, 2 IRC mentions
Fabianx: jenlampton: above issue would be good for twigterns.
Jennifer Lampton: Fabianx: better than https://drupal.org/node/2006152?
Druplicon: https://drupal.org/node/2006152 => [meta] Don't call theme() directly anywhere outside drupal_render() [#2006152] => Drupal core, theme system, normal, active, 21 comments, 11 IRC mentions
Jennifer Lampton: yeah, Tues/Thurs steveoliver
Fabianx: jenlampton: just one more manual test, pager is important.
Jennifer Lampton: okay
steveoliver: bbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment