function tripal_example_menu

2.x tripal_example.module tripal_example_menu()

Implements hook_menu()

Specifies menu items and URLs used by this module.

File

tripal_example/tripal_example.module, line 67
This file contains all Drupal hooks for the module other than any node hooks and block hooks. Those go in the [module name].chado_node.inc file and [module_name].blocks.inc respectively

Code

function tripal_example_menu() {
  $items = array();

  // EXPLANATION:  the $items array should be populated to contain a list of
  // menu items or URL callbacks that our module needs.
  // all Tripal Extension modules should provide at least these menu items:
  //  * A menu item for an administrative home page
  //  * A menu item for 'Help' documentation
  //  * A menu item for a module configuration page
  //
  // Additionally, if your module defines a custom node type that is linked
  // to a record in Chado:
  //  * A menu item for syncing drupal nodes with Chado records.
  //

  // EXPLANATION:  all extension modules should have an administrative menu item
  // with the path set to 'admin/tripal/extension/[module name]'. This will
  // place the menu item in the 'Tripal' -> 'Extension Modules' page. Because
  // this is an administrative menu item we must be sure to set the
  // 'access arguments' to be 'administer tripal example' which is a permission
  // type we created in the tripal_example_permissions() function above.
  $items['admin/tripal/extension/tripal_example'] = array(
    'title' => 'Examples',
    'description' => 'Example module for help with development of new extension modules.',
    'page callback' => 'tripal_example_admin_examples_listing',
    'access arguments' => array('administer tripal example'),
    'type' => MENU_NORMAL_ITEM,
    // We include the file where the 'page callback' function
    // is located.  This removes the need to include all of the
    // include files at the top of the module, and speeds
    // module loading time.
    'file' => '/includes/tripal_example.admin.inc',
  );

  // EXPLANATION: all extension modules should provide help documentation to
  // describe the functionality of the module and any installation or setup
  // tasks that may be required. The menu 'type' is MENU_LOCAL_TASK so that the
  // link appears in a tab on the extension module's administrative page.
  // Here the 'page callback' specifies that we are using Drupal's theme
  // function and the 'page_arguments' indicate the name of the template file
  // Thus, all help documentation should be provided in the
  // [module name]/theme/tripal_example_help.tpl.php file.
  $items['admin/tripal/extension/tripal_example/help'] = array(
    'title' => 'Help',
    'description' => 'Basic Description of Tripal Library Module Functionality',
    'page callback' => 'theme',
    'page arguments' => array('tripal_example_help'),
    'access arguments' => array('administer tripal example'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );

  // EXPLANATION: all extension modules should provide a configuration page.
  // Even if your module does not need configuration the menu item and page
  // should be created. This helps users recognize that the module is installed
  // and working. The configuration page can simply state that no configuration
  // settings are available. Typically a form is provided for the module's
  // configuration settings. Therefore the 'page callback' uses the
  // drupal_get_form() function and the 'page argument' indicates the form
  // to call is named 'tripal_eample_admin'. The function that describes
  // to form is in the includes/tripal_example.admin.inc file.
  $items['admin/tripal/extension/tripal_example/configuration'] = array(
    'title' => 'Settings',
    'description' => 'Configure the Tripal Library module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tripal_example_admin'),
    'access arguments' => array('administer tripal example'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 5,
  );

  // EXPLANATION: If your module defines a new chado node type and that node
  // type directly links to a record in Chado, then you can use the Tripal API
  // to quickly provide syncing functionality. See the API documentation here
  // for more information on how that is setup:
  // http://api.tripal.info/api/tripal/tripal_core%21api%21tripal_core.chado_nodes.api.inc/function/chado_node_sync_form/2.x
  $items['admin/tripal/extension/tripal_example/sync'] = array(
    'title' => ' Sync',
    'description' => 'Create pages on this site for examples stored in Chado',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('chado_node_sync_form', 'tripal_example', 'chado_example'),
    'access arguments' => array('administer tripal example'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );

  // EXPLANATION: If your module defines a new node type that uses the default
  // table of contents (left-side bar of content panes on a page). Then a 'TOC'
  // link will automatically appear on the node page to allow for customization
  // of the TOC. However those customizations are only node specific. To provide
  // a tab in the module's administrative pages add the following menu item.
  // This menu will provide a form similar to the one found on the node that
  // allows the user to set global TOC settings for the content type. Be sure to
  // always use a menu path of the form:
  //   admin/tripal/chado/[module name]/[content type name]_toc
  // this allows for a module to support TOC management when there are multiple
  // content types provided by the module, as the content type is specified
  // in the menu path.
  $items['admin/tripal/chado/tripal_example/chado_example_toc'] = array(
    'title' => ' TOC',
    'description' => 'Manage the table of contents for example nodes.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tripal_core_content_type_toc_form', 'chado_example'),
    'access arguments' => array('administer tripal example'),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/tripal_core.toc.inc',
    'file path' => drupal_get_path('module', 'tripal_core'),
    'weight' => 3
  );

  return $items;
}