Example scaffolding

You can use the following code to create an example.module which you can use to experiment with the examples in this guide.

  1. // example.module
  2. function example_menu($maycache) {
  3.   if ($maycache) {
  4.     $items[] = array(
  5.       'path' => 'scratch/elements',
  6.       'access' => user_access('administer site configuration'),
  7.       'type' => MENU_NORMAL_ITEM,
  8.       'title' => t('Elements'),
  9.       'callback' => 'drupal_get_form',
  10.       'callback arguments' => array('example_elements_form'),
  11.     );
  12.     return $items;
  13.   }
  14. }

  1. ; example.info
  2. name = "Example"
  3. description = "Quick scratch module."

Average: 5 (1 vote)