By enjoylife-2 on
foreach ($vars['node']->taxonomy as $term) {
$vars['taxonomy_classes'] .= ' taxonomy-' . $term->tid;
}
the code is from someone , how i know the $term is an object. in drupal, how i know which variable is an object? thank you.
Comments
.
You print a var_dump of it. That'll tell you whether it's an object, an array, a string, an int, a bool, ... and you'll get type and value of all contents (each value of an array / each property of an object)
Eg:
Devel module
Install the devel module and use its nifty functions:
https://ratatosk.backpackit.com/pub/1836982-debugging-drupal
_
Very briefly, the PHP function is_object($var) will return true if $var is an object and false otherwise,