Created
June 6, 2013 19:54
-
-
Save steveoliver/5724411 to your computer and use it in GitHub Desktop.
Response to https://drupal.org/node/2008450
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Discussing this on our call today, Fabianx pointed out one possibility. Take our example of image field instances within a node template: | |
| To get at the src (or any other) attribute of the first image field instance, one would print: | |
| <code>{{ content.field_image.attributes.src }}</code> | |
| 1. The field <code>attributes</code> have not yet been prepared in the context of the parent node template. | |
| 2. <code>TwigTemplate::getAttribute()</code> determines the attribute does not exist and then calls a function, tentatively named <code>render_structure()</code>, which returns the variables as would be available in the child template. | |
| 3. Then .src and other variables are available. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment