You are here

function contact_menu in Drupal 4

Same name and namespace in other branches
  1. 5 modules/contact/contact.module \contact_menu()
  2. 6 modules/contact/contact.module \contact_menu()
  3. 7 modules/contact/contact.module \contact_menu()

Implementation of hook_menu().

File

modules/contact.module, line 42
Enables the use of personal and site-wide contact forms.

Code

function contact_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/contact',
      'title' => t('contact form'),
      'callback' => 'contact_admin_categories',
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'path' => 'admin/contact/category',
      'title' => t('categories'),
      'callback' => 'contact_admin_categories',
      'access' => user_access('administer site configuration'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/contact/category/list',
      'title' => t('list'),
      'callback' => 'contact_admin_categories',
      'access' => user_access('administer site configuration'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/contact/category/add',
      'title' => t('add category'),
      'callback' => 'contact_admin_edit',
      'access' => user_access('administer site configuration'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/contact/category/edit',
      'title' => t('edit contact category'),
      'callback' => 'contact_admin_edit',
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/contact/category/delete',
      'title' => t('delete contact'),
      'callback' => 'contact_admin_delete',
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/contact/settings',
      'title' => t('settings'),
      'callback' => 'contact_admin_settings',
      'access' => user_access('administer site configuration'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'contact',
      'title' => t('contact'),
      'callback' => 'contact_mail_page',
      'access' => user_access('access content'),
      'type' => MENU_SUGGESTED_ITEM,
    );
  }
  else {
    if (arg(0) == 'user' && is_numeric(arg(1))) {
      $items[] = array(
        'path' => "user/" . arg(1) . "/contact",
        'title' => t('contact'),
        'callback' => 'contact_mail_user',
        'type' => MENU_LOCAL_TASK,
        'weight' => 2,
      );
    }
  }
  return $items;
}