starsbion.blogg.se

Drupal devel theme variables
Drupal devel theme variables










drupal devel theme variables

As shown in Figure 16–2, you can click the heading and expand the contents of each part one by one.įigure 16–2.

drupal devel theme variables

What's nice about using dpm() is that the array is neatly printed using the $messages variable in, which is where system status messages are located. In Figure 16–1, you see the result of printing the contents of the $variables array using the dpm() function. As an example, try adding to the top of your file.įigure 16–1. When working with templates and preprocess functions, you'll usually print $variables using dsm() or dsm().

drupal devel theme variables

Upon installing the Devel module, you'll have access to functions like dpm() and kpr() among others. Luckily, thanks to the Devel module and the Krumo library, printing compact and easily readable arrays is a piece of cake. These functions are great for small arrays, but Drupal's arrays are known for being tremendous, thus using these functions while coding the front end of a site is annoying, to say the least. There's also var_dump(), get_defined_vars() and Drupal's own debug(). One of the most common ways is to use the print_r() function. There are various ways to print arrays using PHP. You'll also find that the various templates and theme functions don't use or document all of the variables that are available, so one of the things you'll often need to do is print the contents of arrays to the screen. When working in the theme layer, you'll find that the variables are different depending on the type of entity with which you are working. Finding Available Variables in the Theme Layer












Drupal devel theme variables