Drupal Debug Dev Tool


/ Published in: Bash
Save to your folder(s)

Drupal Debugging like Dev Tools


Copy this code and paste it in your HTML
  1. 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
  2.  
  3. Installation:
  4. 1. Install module: drush en -y pc
  5.  
  6. 2. Install library: drush pc-download
  7.  
  8. 3. Install Chrome extension: https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
  9.  
  10.  
  11. Usage:
  12. 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.
  13.  
  14. 2. Press F12 to load your Chrome’s Developer Tools and click on the Console tab
  15.  
  16. 3. In your code, anywhere you want to debug a variable or output a value, insert: pc($myInterestingVariable, 'my optional tag');
  17.  
  18.  
  19. 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.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.