function crm_core_relationship_ui_menu in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_menu()
- 8.2 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_menu()
- 7 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_menu()
Implements hook_menu().
File
- modules/
crm_core_relationship_ui/ crm_core_relationship_ui.module, line 16 - Relationship UI module hooks.
Code
function crm_core_relationship_ui_menu() {
$items = [];
/*
* CRM Contact Relationships
*/
$relation_paths = [
'no_contact' => 'crm-core/contact/relationship-add',
'contact' => 'crm-core/contact/%crm_core_contact/relationships/add',
];
foreach ($relation_paths as $key => $path) {
$items[$path] = [
'title' => 'Add a relationship',
'description' => 'Add a relationship to this contact',
'page callback' => 'crm_core_relationship_ui_add_relationship',
'page arguments' => [
$key == 'contact' ? 2 : NULL,
],
'access callback' => TRUE,
'type' => MENU_LOCAL_ACTION,
'file' => 'crm_core_relationship_ui.pages.inc',
'weight' => 10,
];
foreach (crm_core_relationship_get_relationships() as $type => $info) {
$items[$path . '/' . $type . '/%'] = [
'title' => 'Add ' . $info->label,
'description' => 'Add a relationship to this contact',
'page callback' => 'crm_core_relation_entity_ui_get_form_wrapper',
'page arguments' => $key == 'contact' ? [
2,
5,
6,
] : [
NULL,
3,
4,
],
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
NULL,
'create_view',
],
'type' => MENU_NORMAL_ITEM,
'file' => 'crm_core_relationship_ui.pages.inc',
];
}
}
$items['crm-core/contact/%crm_core_contact/relationships/add/%relation_type/%/autocomplete'] = [
'page callback' => 'crm_core_relationship_ui_add_relationship_autocomplete',
'page arguments' => [
2,
5,
6,
],
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
5,
'create',
],
'type' => MENU_CALLBACK,
'file' => 'crm_core_relationship_ui.pages.inc',
];
$items['crm-core/relationships/%relation_type/%/autocomplete'] = [
'page callback' => 'crm_core_relationship_ui_add_relationship_autocomplete',
'page arguments' => [
NULL,
2,
3,
],
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
2,
'create',
],
'type' => MENU_CALLBACK,
'file' => 'crm_core_relationship_ui.pages.inc',
];
/*
* CRM Relationship types
*/
$items['admin/structure/crm-core/relationship-types'] = [
'title' => 'CRM Core Relationship Types',
'description' => 'Manage relationship types.',
'page callback' => 'crm_core_relationship_ui_types_overview',
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
NULL,
'admin',
],
'file' => 'crm_core_relationship_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
];
$items['admin/structure/crm-core/relationship-types/add'] = [
'title' => 'Add crm relationship type',
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
NULL,
'admin',
],
'page callback' => 'drupal_get_form',
'page arguments' => [
'crm_core_relationship_ui_type_form',
],
'type' => MENU_LOCAL_ACTION,
'file' => 'crm_core_relationship_ui.admin.inc',
];
$items['admin/structure/crm-core/relationship-types/manage/%crm_core_relationship_ui_relationship_type'] = [
'title' => 'Edit crm relationship type',
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
NULL,
'admin',
],
'page callback' => 'drupal_get_form',
'page arguments' => [
'crm_core_relationship_ui_type_form',
5,
],
'file' => 'crm_core_relationship_ui.admin.inc',
'type' => MENU_CALLBACK,
];
$items['admin/structure/crm-core/relationship-types/manage/%crm_core_relationship_ui_relationship_type/delete'] = [
'access callback' => 'crm_core_relationship_access_permissions',
'access arguments' => [
NULL,
'admin',
],
'page callback' => 'drupal_get_form',
'page arguments' => [
'crm_core_relationship_ui_type_delete_confirm',
5,
],
'file' => 'crm_core_relationship_ui.admin.inc',
'type' => MENU_CALLBACK,
];
$items['crm-core/contact/%/relationships/%/active'] = [
'title' => 'Toggle relationship status',
'access arguments' => [
'edit relations',
],
'page callback' => 'crm_core_relationship_ui_toggle_relationship_status',
'page arguments' => [
4,
TRUE,
],
'file' => 'crm_core_relationship_ui.pages.inc',
];
$items['crm-core/contact/%/relationships/%/inactive'] = [
'title' => 'Toggle relationship status',
'access arguments' => [
'edit relations',
],
'page callback' => 'crm_core_relationship_ui_toggle_relationship_status',
'page arguments' => [
4,
FALSE,
],
'file' => 'crm_core_relationship_ui.pages.inc',
];
$items['crm-core/contact/%/relationships/%relation/edit'] = [
'title' => 'Edit',
'access arguments' => [
'edit relations',
],
'page callback' => 'drupal_get_form',
'page arguments' => [
'relation_edit_form',
4,
],
'type' => MENU_LOCAL_ACTION,
];
$items['crm-core/contact/%/relationships/%relation/delete'] = [
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => [
'relation_delete_confirm',
4,
],
'access arguments' => [
'delete relations',
],
'weight' => 10,
'type' => MENU_LOCAL_ACTION,
];
return $items;
}