6

I super love Krumo/Devel. However, I'm sure I'm missing something obvious, because when I use dsm() and I get my array or object all expandable and awesome, sometimes I have a hard time knowing which array or object it is. At the top, it just says ... (Object) stdClass.

Is there somewhere that it includes the name of the object/array you're exploring? What about on the devel tab of a node?

4

Unfortunately, as per paragraph 4 here http://krumo.sourceforge.net/ it will not print the variable name. However, as it mentions, at the bottom of the krumo output it will tell you exactly where the call came from (file name and line number).

The object or array being printed out is always the variable inside your kpr call (or dsm/dpm). ie kpr($user) won't state explicitly that it is printing the $user variable.

On the devel tab of a node the object printed is the node object itself: $vars['node'] or $node depending on your setup.

7

Sometimes, if I need to differentiate between different debug items, I'll use something like the following:

kpr(array(
  'node' => $node,
  'comments' => $comments,
  'links' => $links,
));

Or, if debug items are split in different places, just simply:

kpr(array('user' => $user));
  • This is a great trick, and you can call 'user' whatever you want. ie (an extreme example): kpr(array('my user var/object on a very important page: admin/user' => $user)); – nedwardss Aug 22 '12 at 14:15
4

Again, Search Krumo can help. Let me show how it works. For example, we want to debug two objects:

  $user = user_load(1);
  sdpm($user); // user object
  sdpm(menu_get_object()); // node object loaded with menu_get_object() function.

We will see something like this:
enter image description here

P.S.There is known bug with devel/php textarea: http://drupal.org/node/1696920. So, don't use sdpm() there.

0

Configuration > Devel settings

Then look at error handlers as they might be switched off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.