Skip to content

Instantly share code, notes, and snippets.

@jonhattan
jonhattan / MODULE.module
Last active December 11, 2015 05:58
Definition and usage of a theme hook. Code provide two alternative options: using a template file or a theme function (commented out). It also implements a block to ilustrate the example.
<?php
/**
* Contents for file MODULE.module
*/
/**
* Implements hook_theme().
*
* Define here a theme hook to be implemented within MODULE.theme.inc as function theme_THEMEHOOK($vars) {}
@jonhattan
jonhattan / mycommands.drush.inc
Last active December 10, 2015 15:28
Example Drush commandfile. Place it in $HOME/.drush or /usr/share/drush/commands or any other valid location and clear drush cache afterwards.
<?php
function mycommands_drush_command() {
$items = array();
$items['one-command'] = array(
'description' => 'A command requiring two arguments.',
// Declare required arguments.
'arguments' => array(
'arg1' => 'arg1 description',
'arg2' => 'arg2 description',