For Drupal 7, how do I access (or generate) a list of all the field variables available for building a template (for a given content type)?
Some context: I used to rely on the (now deprecated) Contemplate module to write my templates. Directly within its interface, it would print a list of all of the available variables, like this.
It was quite handy. Now that I'm making disk-based templates and do not have this list generated by the Contemplate module, I'm confused as to how I might produce something similar for use as a reference.
{{ dump() }}
will show you the available variables if you have debugging output enabled. The contemplate module did its own thing (one "magic" function calledcontemplate_array_variables
) so I doubt you'll find anything quite the same. Discovering and Inspecting Variables in Twig Templates has some more information<?php dpm(get_defined_vars()); ?>
with the drupal.org/project/devel module installed.