debug drush (and php-cli)

Drush uses the cli version of php so traditional debugging tools and functions don't work.

  1. // add --debug to the end of a drush command
  2. drush vget site_name --debug
  3.  
  4. // output a message to the screen
  5. drush_log("my message");
  6.  
  7. // get information over the php version (php_info)
  8. drush php-eval "phpinfo();" | less
  9.  
  10. // to debug an aegir command
  11. // /usr/bin/php /opt/drush/drush.php --php='/usr/bin/php' --root='/var/aegir/platforms/drupal-7.22' provision-save '@platform_drupal722' --backend 2>&1
  12. /usr/bin/php /opt/drush/drush.php --php='/usr/bin/php' --root='/var/aegir/platforms/drupal-7.22' provision-save '@platform_drupal722' --debug

Form field conditionnal display

In this snippet the text field mycustom is only displayed if the value of the select field myoptions is custom

Theme and render

display some content using drupal_render() and theme (this is the official way to use theme function)

Simple block definition

Define and set content into a block. See hook_block_configure and hook_block_save if you want people be able to choose options.

Form declaration (from menu to submit)

Output a simple form, with validation and submit handlers

Jquery file structure declaration

Declare custom jquery code (attached to a theme or module) so that $ selector is available