0

On my Drupal 7 Site I am trying to create my very first own module. I've got a custom node_insert hook like the one below:

function sample_node_insert($node){
  dpm($node);
  var_dump($node);
}

I just want to see what is inside of $node, but I just can't get it! I tried creating a new node and watching out for some output, but I couldn't manage to find any. What am I doing wrong?

Lumination
  • 47
  • 7

2 Answers2

0

you can do exit(); after printing, to make sure no other implementation of this hook get ran.

rwaery
  • 99
  • 5
0

Your code should be actually working, you do not even need var_dump(). Make sure your theme is displaying messages on the page as dpm() puts krumo dump into messages. You can do so by searching for <?php print $messages; ?> in the page.tpl.php file of the theme you're using.

Or, if you are testing your code in a page callback function, and you are receiving blank screen, make sure the function returns any string, simple return "Hello world"; should be enough.

Or, as previously suggested, you can do

var_dump($node);
die();

but that produces pretty ugly result.

bbujisic
  • 508
  • 5
  • 8