technicka.netfrom the cerebrum of Becky Gessler

Viewing Variables in Drupal

These are two ways to get an output of all the available variables you have for the given node you are working on in Drupal. The last example is a preprocess function for showing all the theme functions being called on a specific $hook.

If you have Devel installed, use this to get a nicely formatted output:
{syntaxhighlighter brush:php;}<?php dsm($node) ?>{/syntaxhighlighter}

And, if you are not working with Devel module, this is the standard way to go about it:
{syntaxhighlighter brush:php;}

<?php print_r($node); ?>

{/syntaxhighlighter}

The "pre" tag will format the output so it's readable.

This one requires Devel as well. This preprocess function outputs a list of all the theme functions being called on the given $hook you are looking at it.
{syntaxhighlighter brush:php;}function themename_preprocess(&$vars, $hook) {
dsm($hook);
}{/syntaxhighlighter}

Filed Under

Related Content

I pwn

Oh hai, my name is Becky and this is my personal website about tech and sometimes my life. I work as a user experience designer for UniversityNow, and I live in San Francisco but I bleed New York.