function subscriptions_menu in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_menu()
- 5 subscriptions.module \subscriptions_menu()
- 7 subscriptions.module \subscriptions_menu()
- 2.0.x subscriptions.module.old.php \subscriptions_menu()
Implementation of hook_menu().
File
- ./
subscriptions.module, line 45 - Subscriptions module.
Code
function subscriptions_menu() {
global $user;
// we need the user to to build some urls
$items['admin/settings/subscriptions'] = array(
'title' => 'Subscriptions',
'description' => 'Enables site settings for user subscriptions.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_settings_form',
),
'access arguments' => array(
'administer site configuration',
),
);
$items['admin/settings/subscriptions/settings'] = array(
'title' => 'Site settings',
'weight' => -10,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/settings/subscriptions/userdefaults'] = array(
'title' => 'User defaults',
'weight' => -5,
'page callback' => 'subscriptions_page_user_overview',
'page arguments' => array(
NULL,
),
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'administer site configuration',
),
);
$items['admin/settings/subscriptions/userdefaults/settings'] = array(
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => 'Overview',
'weight' => -10,
);
$items['admin/settings/subscriptions/userdefaults/bulk'] = array(
'title' => 'Bulk operation',
'weight' => -8,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_page_user_bulk',
),
'type' => MENU_LOCAL_TASK,
'access callback' => '_subscriptions_bulk_access',
);
$items['admin/settings/subscriptions/intervals'] = array(
'title' => 'Interval',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_intervals',
),
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'administer site configuration',
),
);
$items['user/%user/subscriptions'] = array(
'title' => 'Subscriptions',
'page callback' => 'subscriptions_page_user_overview',
'page arguments' => array(
1,
),
'type' => MENU_LOCAL_TASK,
'access callback' => '_subscriptions_access',
'access arguments' => array(
1,
),
);
$hide_overview_page = variable_get('subscriptions_hide_overview_page', 0);
if (!$hide_overview_page) {
$items['user/%user/subscriptions/overview'] = array(
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => 'Overview',
'weight' => -10,
);
}
else {
$minimum_weight = 0;
foreach (subscriptions_types() as $stype => $data) {
if (isset($data['weight']) && $data['weight'] < $minimum_weight) {
$minimum_weight = $data['weight'];
}
}
}
foreach (subscriptions_types() as $stype => $data) {
$weight = isset($data['weight']) ? $data['weight'] : 0;
$items['subscriptions/add/' . $stype] = array(
'title' => 'Add subscription',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_add_form',
$stype,
),
'access arguments' => array(
$data['access'],
),
);
$items['subscriptions/del/' . $stype] = array(
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_del_form',
$stype,
),
'access arguments' => array(
$data['access'],
),
);
if (empty($data['page'])) {
continue;
// no page
}
$items['user/%user/subscriptions/' . $stype] = array(
'title' => 'N/A',
// for l.d.o, overwritten below
'type' => MENU_LOCAL_TASK,
'file' => 'subscriptions.admin.inc',
'page callback' => 'subscriptions_page',
'page arguments' => array(
1,
$stype,
),
'access callback' => '_subscriptions_access',
'access arguments' => array(
1,
$data['access'],
),
'weight' => $weight,
);
$items['user/%user/subscriptions/' . $stype]['title'] = $data['title'];
if ($hide_overview_page && $minimum_weight == $weight) {
// Install the first subscription type page as the default task.
$items['user/%user/subscriptions/' . $stype]['type'] = MENU_DEFAULT_LOCAL_TASK;
$default_item = $items['user/%user/subscriptions/' . $stype];
$items['user/%user/subscriptions'] = array_merge($items['user/%user/subscriptions'], array(
'file' => $default_item['file'],
'page callback' => $default_item['page callback'],
'page arguments' => $default_item['page arguments'],
'access callback' => $default_item['access callback'],
'access arguments' => $default_item['access arguments'],
));
$hide_overview_page = FALSE;
}
if ($stype == 'node') {
continue;
// not in site settings
}
$items['admin/settings/subscriptions/userdefaults/' . $stype] = array(
'title' => 'N/A',
// for l.d.o, overwritten below
'type' => MENU_LOCAL_TASK,
'file' => 'subscriptions.admin.inc',
'page callback' => 'subscriptions_page',
'page arguments' => array(
NULL,
$stype,
),
'access arguments' => array(
'administer site configuration',
),
'weight' => $weight,
);
$items['admin/settings/subscriptions/userdefaults/' . $stype]['title'] = $data['title'];
}
// Unsubscribe links
$items['subscriptions/rem/%'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'subscriptions_delete_form',
2,
3,
4,
5,
6,
),
'type' => MENU_CALLBACK,
'access callback' => '_subscriptions_rem_access',
'access arguments' => array(
2,
3,
4,
5,
6,
7,
),
);
return $items;
}