function heartbeat_menu in Heartbeat 6.4
Same name and namespace in other branches
- 6.2 heartbeat.module \heartbeat_menu()
- 6.3 heartbeat.module \heartbeat_menu()
- 7 heartbeat.module \heartbeat_menu()
Implementation of hook_menu().
File
- ./
heartbeat.module, line 136
Code
function heartbeat_menu() {
// Import default data on cache clear
heartbeat_default_data();
$items = array();
// Menu page callbacks for each heartbeat access type
$access_types = variable_get('heartbeat_access_types', array());
foreach ($access_types as $access_type => $type) {
$menu_item_type = isset($type['settings']['page_disabled']) && $type['settings']['page_disabled'] ? MENU_NORMAL_ITEM : MENU_CALLBACK;
$items['heartbeat/' . $access_type] = array(
'title callback' => 'heartbeat_messages_title',
'title arguments' => array(
1,
),
'description' => $type['name'] . ' page',
'page callback' => 'heartbeat_messages_page',
'page arguments' => array(
1,
),
'access callback' => '_heartbeat_access_type_has_access',
'access arguments' => array(
1,
),
'file' => 'heartbeat.pages.inc',
'type' => $access_type == 'singleheartbeat' ? MENU_CALLBACK : $menu_item_type,
);
}
$items['heartbeat/message/%'] = array(
'title callback' => 'heartbeat_activity_title',
'title arguments' => array(
2,
),
'description' => 'Activity message',
'page callback' => 'heartbeat_message_activity',
'page arguments' => array(
2,
),
'access callback' => '_heartbeat_message_has_access',
'access arguments' => array(
2,
),
'file' => 'heartbeat.pages.inc',
);
// Add menu items for user profile tasks
$default_stream_data = array(
'privateheartbeat' => array(
'profile' => 1,
),
'publicheartbeat' => array(
'profile' => 0,
),
);
foreach (variable_get('heartbeat_stream_data', $default_stream_data) as $stream_name => $data) {
if (isset($data['profile']) && $data['profile'] == 1) {
$items['user/%user/heartbeat/' . $stream_name] = array(
'title callback' => 'heartbeat_messages_title',
'title arguments' => array(
$stream_name,
),
'page callback' => 'heartbeat_messages_page',
'page arguments' => array(
$stream_name,
'0',
1,
),
'access callback' => '_heartbeat_access_type_has_access',
'access arguments' => array(
$stream_name,
),
'type' => MENU_LOCAL_TASK,
'file' => 'heartbeat.pages.inc',
'weight' => 50,
);
}
}
// Build content administration
$items['admin/content/heartbeat'] = array(
'title' => 'administer heartbeat activity',
'description' => 'Administer heartbeat activity',
'weight' => -5,
'page callback' => 'heartbeat_activity_admin',
'access arguments' => array(
'delete heartbeat activity logs',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/content/heartbeat/activity'] = array(
'title' => 'List activity messages',
'description' => 'Overview activity messages',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -5,
);
// Build menu
$items['admin/build/heartbeat'] = array(
'title' => 'Heartbeat',
'description' => 'Administer messages for heartbeat.',
'page callback' => 'heartbeat_messages_overview',
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/list'] = array(
'title' => 'List message templates',
'description' => 'Overview messages',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -5,
);
$items['admin/build/heartbeat/add'] = array(
'title' => 'Add template',
'description' => 'Administer message for heartbeat.',
'weight' => -4,
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_messages_add',
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/export'] = array(
'title' => 'Export templates',
'description' => 'Export messages to use as default.',
'weight' => -3,
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_messages_export',
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/import'] = array(
'title' => 'Import templates',
'description' => 'Import messages to use as custom ones.',
'weight' => -3,
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_messages_import',
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
// Streams
$items['admin/build/heartbeat/streams'] = array(
'title' => 'Heartbeat streams',
'weight' => 0,
'description' => 'Administer heartbeat streams.',
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_messages_access_types',
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/stream/%heartbeat_stream'] = array(
'title' => 'Configure heartbeat activity stream',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_activity_stream_configure',
4,
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/stream/%heartbeat_stream/clone'] = array(
'title' => 'Clone heartbeat activity stream',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_activity_stream_clone',
4,
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/edit/%heartbeat_message'] = array(
'title' => 'Edit heartbeat message',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_messages_edit',
4,
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
);
$items['admin/build/heartbeat/revert/%'] = array(
'title' => 'Revert heartbeat message',
'description' => 'Revert message back to default.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_revert_confirm',
4,
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
'type' => MENU_CALLBACK,
);
$items['admin/build/heartbeat/delete/%heartbeat_message'] = array(
'title' => 'Delete heartbeat message',
'description' => 'Administer deletions of messages.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_delete_confirm',
4,
),
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
'type' => MENU_CALLBACK,
);
$items['heartbeat/delete/%'] = array(
'title' => 'Delete activity log',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_delete_log_confirm',
2,
),
'access callback' => '_heartbeat_message_delete_access',
'access arguments' => array(
2,
),
'file' => 'heartbeat.pages.inc',
'type' => MENU_CALLBACK,
);
// Administer settings
$items['admin/build/heartbeat/settings'] = array(
'title' => 'heartbeat settings',
'description' => 'Administer settings for heartbeat.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_admin_settings',
),
'access arguments' => array(
'configure heartbeat',
),
'file' => 'heartbeat.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items['admin/build/heartbeat/cache-clear'] = array(
'title' => 'Delete activity logs',
'description' => 'Delete heartbeat activity logs.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'heartbeat_delete_logs_confirm',
),
'access arguments' => array(
'delete heartbeat activity logs',
),
'file' => 'heartbeat.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
// Javascript driven callbacks
$items['heartbeat/autocomplete/tag'] = array(
'access callback' => 'user_access',
'access arguments' => array(
'configure heartbeat messages',
),
'file' => 'heartbeat.admin.inc',
'type' => MENU_CALLBACK,
'page callback' => 'heartbeat_autocomplete_tag',
);
$items['heartbeat/ahah/%'] = array(
'page callback' => 'heartbeat_activity_ahah',
'page arguments' => array(
2,
),
'access callback' => 'user_access',
'access arguments' => array(
'configure heartbeat',
),
'type' => MENU_CALLBACK,
'file' => 'heartbeat.admin.inc',
);
$items['heartbeat/js/poll'] = array(
'page callback' => 'heartbeat_activity_poll',
'access callback' => 'user_access',
'access arguments' => array(
'view heartbeat messages',
),
'type' => MENU_CALLBACK,
'file' => 'heartbeat.pages.inc',
);
return $items;
}