function party_menu in Party 8.2
Same name and namespace in other branches
- 7 party.module \party_menu()
Implements hook_menu().
File
- ./
party.module, line 98 - 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' => 'Label Plugins',
'description' => 'Determine how labels for parties are generated.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_settings_label_plugins_form',
),
'access arguments' => array(
'administer crm settings',
),
'file' => 'party.admin.inc',
);
$items['admin/config/party/primary-fields'] = array(
'title' => 'Primary Fields',
'description' => 'Specify where to take primary fields from.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'party_settings_primary_fields_form',
),
'access arguments' => array(
'administer crm settings',
),
'file' => 'party.admin.inc',
);
$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 parties',
),
'file' => 'party.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items['admin/community/party'] = array(
'title' => 'Manage parties',
'description' => 'Manage contact information',
'page callback' => 'party_info',
'access arguments' => array(
'administer parties',
),
'file' => 'party.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$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/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;
}