Skip to content

Instantly share code, notes, and snippets.

@gregmercer
Created August 10, 2012 00:04
Show Gist options
  • Save gregmercer/3309318 to your computer and use it in GitHub Desktop.
Save gregmercer/3309318 to your computer and use it in GitHub Desktop.
Drupal: hook_menu example to create a page
/**
* Implements hook_menu().
*/
function <replace with module name>_menu() {
$items['path1/path2'] = array(
'title' => 'some text for the title',
'description' => 'some text for the description',
'page callback' => '<replace with module name>_page',
'page arguments' => array(1),
'access arguments' => array('access content'),
);
return $items;
}
/**
* Menu callback.
* Creates a page in drupal with the path 'path1/path2'
*/
function <replace with module name>_page($some_arg) {
$output = t('some text for the page');
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment