Drupal for Firebug won’t work on form submission using firep($item,$title)

Drupal for Firebug was developed as a way to extend the capabilities of Firebug by providing developers with a handy framework to access and display server-side Drupal information directly to Firebug console.

Thus, a developer can see debug messages, examine the SQL query log (with Devel module), look at how a Drupal page load is handling a site’s users, views, nodes, and forms, and even execute PHP.

By using the firep($item, $title) in any module you can output any variable to Firebug with some limitations. For instance I wanted to debug the $form_state array to check the form values sent on submission by using the following code:

function mymodule_form_submit($form, &$form_state)
  firep($form_state, 'values submitted');

This code didn’t output anything to Firebug console as I was only able to see:

firebug1After digging around and tracing the Drupalforfirebug code down I discovered that the form submission triggers the drupalforfirebug_shutdown() twice which makes the printed messages to disappear.

To overcome this and get the firep() function to do its job on form submission, just disable the default form redirection with:

function mymodule_form_submit($form, &$form_state)
  $form_state['redirect'] = FALSE;
  firep($form_state, 'values submitted');

This worked for me in the sense I was able to view the content of $form_state array.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s