function contact_menu in Drupal 5
Same name and namespace in other branches
- 4 modules/contact.module \contact_menu()
- 6 modules/contact/contact.module \contact_menu()
- 7 modules/contact/contact.module \contact_menu()
Implementation of hook_menu().
File
- modules/
contact/ 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/build/contact',
'title' => t('Contact form'),
'description' => t('Create a system contact form and set up categories for the form to use.'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
);
$items[] = array(
'path' => 'admin/build/contact/list',
'title' => t('List'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/build/contact/add',
'title' => t('Add category'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'contact_admin_edit',
),
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items[] = array(
'path' => 'admin/build/contact/edit',
'title' => t('Edit contact category'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'contact_admin_edit',
),
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/build/contact/delete',
'title' => t('Delete contact'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'contact_admin_delete',
),
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/build/contact/settings',
'title' => t('Settings'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'contact_admin_settings',
),
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
$items[] = array(
'path' => 'contact',
'title' => t('Contact'),
'callback' => 'contact_site_page',
'access' => user_access('access site-wide contact form'),
'type' => MENU_SUGGESTED_ITEM,
);
}
else {
if (arg(0) == 'user' && is_numeric(arg(1))) {
global $user;
$account = user_load(array(
'uid' => arg(1),
));
if ($user->uid != $account->uid && $account->contact || user_access('administer users')) {
$items[] = array(
'path' => 'user/' . arg(1) . '/contact',
'title' => t('Contact'),
'callback' => 'contact_user_page',
'type' => MENU_LOCAL_TASK,
'access' => $user->uid,
'weight' => 2,
);
}
}
}
return $items;
}