Category — Drupal

Drupal Tips: Expose Available Drupal Variables

0

Ever wanted more than just dumping the content of the node you’re in, or it’s additional variables? In Drupal you can still do this using a basic PHP command, get_defined_vars() .

Open up any of your template files and paste the following code in (generally just page.tpl.php).


print '<pre>';
print_r(get_defined_vars());
print '</pre>';

The result is a dump of all variables available to you in your theming work!