function wikitools_menu in Wikitools 5
Same name and namespace in other branches
- 6.2 wikitools.module \wikitools_menu()
- 6 wikitools.module \wikitools_menu()
- 7 wikitools.module \wikitools_menu()
Implementation of hook_menu().
File
- ./
wikitools.module, line 29 - A non-intrusive module to have some wiki-like behaviour.
Code
function wikitools_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/wikitools',
'title' => t('Wikitools'),
'description' => t('Settings for wiki-like behaviour.'),
'access' => user_access('administer site configuration'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'wikitools_admin_settings',
),
'type' => MENU_NORMAL_ITEM,
);
}
else {
$wiki_path = wikitools_wiki_path();
if (!empty($wiki_path)) {
if ($wiki_path != '<none>') {
$items[] = array(
'path' => $wiki_path,
'callback' => 'wikitools_handle_request',
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
);
}
}
else {
$result = wikitools_handle_request();
if ($result !== FALSE) {
$items[] = array(
'path' => $_GET['q'],
'callback' => 'wikitools_page_value',
'callback arguments' => $result,
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
);
}
}
// Override the callback for node deletion if the delete protection option is set.
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if (wikitools_type_affected($node->type) && wikitools_delete_protection()) {
// Hijack delete callback and call custom handler.
$items[] = array(
'path' => 'node/' . arg(1) . '/delete',
'title' => t('Delete'),
'callback' => 'wikitools_delete_protection_delete_confirm',
'callback arguments' => array(
$node,
),
'access' => node_access('delete', $node),
'weight' => 1,
'type' => MENU_CALLBACK,
);
}
}
// Only hijack freelinking path if an argument is specified, otherwise let the freelinking page show.
if (module_exists('freelinking') && wikitools_hijack_freelinking() && arg(1)) {
$items[] = array(
'path' => 'freelinking',
'callback' => 'wikitools_handle_request',
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
);
}
if (wikitools_enforce_unique_titles()) {
$items[] = array(
'path' => 'admin/content/wikitools',
'title' => t('Duplicate titles'),
'description' => t('List nodes which have duplicate titles'),
'access' => user_access('administer nodes'),
'callback' => 'wikitools_page_duplicates',
'type' => MENU_NORMAL_ITEM,
);
}
}
return $items;
}