function simplenews_menu in Simplenews 5
Same name and namespace in other branches
- 6.2 simplenews.module \simplenews_menu()
- 6 simplenews.module \simplenews_menu()
- 7.2 simplenews.module \simplenews_menu()
- 7 simplenews.module \simplenews_menu()
Implementation of hook_menu().
File
- ./
simplenews.module, line 61
Code
function simplenews_menu($may_cache) {
$items = array();
$administer = user_access('administer newsletters');
if ($may_cache) {
$items[] = array(
'path' => 'node/add/simplenews',
'title' => t('Newsletter issue'),
'access' => user_access('create newsletter'),
);
$items[] = array(
'path' => 'admin/content/newsletters',
'title' => t('Newsletters'),
'type' => MENU_NORMAL_ITEM,
'description' => t('Manage newsletters, subscriptions, and configuration options.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_news',
),
'access' => $administer,
);
$items[] = array(
'path' => 'admin/content/newsletters/sent',
'title' => t('Sent issues'),
'access' => $administer,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_news',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/notsent',
'title' => t('Drafts'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -9,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_news',
'notsent',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/types',
'title' => t('Newsletters'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -8,
'callback' => 'simplenews_types_overview',
);
$items[] = array(
'path' => 'admin/content/newsletters/types/edit',
'title' => t('Newsletters'),
'access' => $administer,
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_types_form',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/types/delete',
'title' => t('Newsletters'),
'access' => $administer,
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_types_delete',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/types/list',
'title' => t('List newsletters'),
'access' => $administer,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/content/newsletters/types/add',
'title' => t('Add newsletter'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -9,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_types_form',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/subscriptions/delete',
'title' => t('Delete'),
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => 'simplenews_subscription_multiple_delete_confirm',
'access' => $administer,
);
$items[] = array(
'path' => 'admin/content/newsletters/users',
'title' => t('Subscriptions'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -7,
'callback' => 'simplenews_subscription_admin',
);
$items[] = array(
'path' => 'admin/content/newsletters/users/edit',
'title' => t('Subscriptions'),
'access' => $administer,
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_users_form',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/users/delete',
'title' => t('Subscriptions'),
'access' => $administer,
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_users_delete',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/users/list',
'title' => t('List subscriptions'),
'access' => $administer,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/content/newsletters/users/import',
'title' => t('Import subscriptions'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -9,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_subscription_list_add',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/users/export',
'title' => t('Export subscriptions'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -8,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_subscription_list_export',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/settings',
'title' => t('Settings'),
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => -6,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_admin_settings',
),
);
$items[] = array(
'path' => 'admin/content/newsletters/settings/general',
'title' => t('General'),
'access' => $administer,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'newsletter/confirm',
'title' => t('Confirm newsletter subscriptions'),
'access' => user_access('subscribe to newsletters'),
'callback' => 'simplenews_confirm_subscription',
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'newsletter/subscriptions',
'title' => t('Manage newsletter subscriptions'),
'access' => user_access('subscribe to newsletters'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'simplenews_subscription_manager_form',
),
'type' => MENU_CALLBACK,
);
}
else {
drupal_add_css(drupal_get_path('module', 'simplenews') . '/simplenews.css', 'module', 'all', TRUE);
if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'newsletters' && arg(3) == 'settings') {
$tree = taxonomy_get_tree(variable_get('simplenews_vid', ''));
if ($tree) {
$weight = -9;
foreach ($tree as $newsletter) {
$items[] = array(
'path' => 'admin/content/newsletters/settings/' . $newsletter->tid,
'title' => $newsletter->name,
'access' => $administer,
'type' => MENU_LOCAL_TASK,
'weight' => $weight++,
);
}
}
}
}
return $items;
}