What has everyone found is the best way to debug a module? I typically will try to print_r and vardump something if I need to.

The reason I ask is that I am currently writing a module that adds new settings to fields of a particular entity type and my usual vardump or print_r strategy isn't serving me all that well.....

Any suggestions?

Thanks in advance for all your help!!

Comments

Jaypan’s picture

A lot of people use the dmp() [Edit: that should be dpm()] function that comes with the Devel module.

You can also use PHP debuggers, or XHProf.

But really, without specifics of what you are debugging, it's pretty hard to give any specific method of debugging.

ETamsberg’s picture

Trying to use the hook_field_info_alter() hook and the hook_form_field_ui_field_edit_form_alter() to add new settings to text field UI for a specific entity type.

Got the idea from the thread at the bottom of this page - https://api.drupal.org/api/drupal/modules!field_ui!field_ui.api.php/func...

leramos’s picture

I believe is dpm() not dmp() but i know you just mistyped it..

Jaypan’s picture

You're right. I edited the original post.

ETamsberg’s picture

Thank you for the advice!

I have used the Devel module before myself and typically use a lot of dprint_r() but I was interested to hear what other people might also do to debug a module.

Thanks again for the input!!

maq.said’s picture

Can some one elaborate all possible ways and scenarios what debug tools can be used?