Return to Snippet

Revision: 68192
at December 8, 2014 13:45 by apro2000


Initial Code
Ever wish you could debug Drupal the same way you debug client-side code in your Chrome Developer Tools?  I recently came across a solution that works well for our needs: https://www.drupal.org/project/pc
 
Installation:
1.       Install module: drush en -y pc

2.       Install library: drush pc-download

3.       Install Chrome extension: https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef

 
Usage:
1.       Load the module’s configuration page in Drupal admin and insert your IP address (or remove the default addresses to allow all access).  Also, uncheck Notifications if you don’t want Chrome desktop notifications popping up all the time.

2.       Press F12 to load your Chrome’s Developer Tools and click on the Console tab

3.  In your code, anywhere you want to debug a variable or output a value, insert:  pc($myInterestingVariable, 'my optional tag');

 
All output is limited to the IP addresses you whitelist in the module configuration so you don’t have to worry about accidentally leaving pc function calls in your production codebase.

Initial URL

                                

Initial Description
Drupal Debugging like Dev Tools

Initial Title
Drupal Debug Dev Tool

Initial Tags
Bash, drupal

Initial Language
Bash