function party_menu in Party 7
Same name and namespace in other branches
- 8.2 party.module \party_menu()
Implements hook_menu().
File
- ./
party.module, line 101 - Provides a generic CRM party entity.
Code
function party_menu() {
// CRM settings.
// Making up a new config category.
// Alternative is to put this all under top-level admin.
// But all this structure is rough anyway.
$items['admin/config/party'] = array(
'title' => 'Party',
'description' => 'Party Settings',
'position' => 'left',
'weight' => -10,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array(
'access administration pages',
),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/config/party/labels/%'] = array(
'title' => 'Configure Plugin',
'description' => 'Configure the Chosen Label Plugin',
'page callback' => 'party_settings_label_plugin_config_page',
'page arguments' => array(
4,
),
'access arguments' => array(
'administer crm settings',
),
'file' => 'party.admin.inc',
);
$items['admin/config/party/piece-order'] = array(
'title' => 'Piece order',
'description' => 'Rearrange the order of pieces within a party.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_settings_pieces_order_form',
),
'access arguments' => array(
'administer crm settings',
),
'file' => 'party.admin.inc',
);
$items['admin/community/datasets'] = array(
'title' => 'Manage data sets',
'page callback' => 'party_data_set_admin',
'access arguments' => array(
'administer crm settings',
),
'file' => 'party.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items['admin/community/party'] = array(
'title' => 'Manage parties',
'description' => 'Manage contact information',
// A copy of the 'Manage fields' menu item from Field UI, as that is our
// default tab.
'access callback' => 'user_access',
'access arguments' => array(
'administer crm settings',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'field_ui_field_overview_form',
'party',
'party',
),
'type' => MENU_LOCAL_TASK,
'file' => 'field_ui.admin.inc',
'file path' => drupal_get_path('module', 'field_ui'),
);
$items['admin/community/party/primary-fields/%'] = array(
'title' => 'Manage primary fields',
'title callback' => 'party_primary_fields_title',
'title arguments' => array(
4,
),
'access callback' => 'user_access',
'access arguments' => array(
'administer crm settings',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_primary_fields_edit_field',
4,
),
'type' => MENU_CALLBACK,
'file' => 'party.admin.inc',
);
$items['party/%party'] = array(
'title callback' => 'party_page_title',
'title arguments' => array(
1,
),
'page callback' => 'party_page_view',
'page arguments' => array(
1,
),
'file' => 'party.pages.inc',
'access callback' => 'party_access',
'access arguments' => array(
'view',
1,
),
'type' => MENU_NORMAL_ITEM,
);
// Build the party view first-level tabs.
// @todo: Write a contrib module to turn a set of tabs into ajax tabs,
// probably using or as part of quicktabs module.
$pieces = party_get_party_piece_info();
// These come sorted by weight so we know which to make the default tab.
foreach ($pieces as $path => $piece) {
if (!isset($seen_first_piece)) {
$seen_first_piece = TRUE;
$piece['type'] = MENU_DEFAULT_LOCAL_TASK;
}
// Add in some defaults for convenience.
// @todo: once these stabilize, document them in the API file.
$piece += array(
'type' => MENU_LOCAL_TASK,
'page arguments' => array(
1,
2,
),
// Make this explicit so it overrides the parent.
'access callback' => 'party_access',
'access arguments' => array(
'view',
1,
2,
),
);
$items["party/%party/{$path}"] = $piece;
}
$items['party/%party/party'] = array(
'title' => 'Overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'access callback' => 'party_access',
'access arguments' => array(
'view',
1,
),
'page callback' => 'party_page_view',
'page arguments' => array(
1,
),
'file' => 'party.pages.inc',
'weight' => -20,
);
// This is temporary until I figure out a neat way to do tabs below pieces.
$items['party/%party/party/view'] = array(
'title' => 'View',
'page callback' => 'party_page_view',
'page arguments' => array(
1,
),
'file' => 'party.pages.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['party/%party/party/edit'] = array(
'title' => 'Edit',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_form',
1,
),
'access callback' => 'party_access',
'access arguments' => array(
'edit',
1,
),
'file' => 'party.pages.inc',
'type' => MENU_LOCAL_TASK,
'weight' => -5,
);
// End temporary.
$items['party/%party/party/archive'] = array(
'title' => 'Archive',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_archive_form',
1,
),
'access callback' => 'party_access',
'access arguments' => array(
'archive',
1,
),
'file' => 'party.pages.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 9,
);
$items['party/%party/party/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_delete_form',
1,
),
'access callback' => 'party_access',
'access arguments' => array(
'delete',
1,
),
'file' => 'party.pages.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
// Attached entity menu items
// Edit an attached entity
$items['party/%party/%party_data_set/edit/%'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_attached_entity_edit_form',
1,
2,
4,
),
'access callback' => 'party_access',
'access arguments' => array(
'edit',
1,
2,
),
'file' => 'party.pages.inc',
);
// Detach an attached entity
$items['party/%party/%party_data_set/remove/%'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_attached_entity_remove_confirm',
1,
2,
4,
),
'access callback' => 'party_access',
'access arguments' => array(
'detach',
1,
2,
),
'file' => 'party.pages.inc',
);
// Add an attached entity
$items['party/%party/%party_data_set/add'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_attached_entity_action_form',
1,
2,
'add',
),
'access callback' => 'party_access',
'access arguments' => array(
'add',
1,
2,
),
'file' => 'party.pages.inc',
);
// Attach an existing entity.
$items['party/%party/%party_data_set/attach'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_attached_entity_action_form',
1,
2,
'attach',
),
'access callback' => 'party_access',
'access arguments' => array(
'attach',
1,
2,
),
'file' => 'party.pages.inc',
);
$items['party/add'] = array(
'title' => 'Add party',
'page callback' => 'party_add',
'file' => 'party.pages.inc',
'access arguments' => array(
'create parties',
),
);
// Provide useful information for developers.
// This may eventually move to a devel_party module if there's more of it.
if (module_exists('devel')) {
$items['devel/crm/info'] = array(
'title' => 'CRM info',
'description' => 'View CRM data.',
'page callback' => 'party_devel_info_page',
'access arguments' => array(
'access devel information',
),
'file' => 'party.admin.inc',
'menu_name' => 'devel',
'weight' => 10,
);
}
return $items;
}