From http://kahthong.com/2013/06/create-your-own-custom-drupal-block-programmatically