poll_menu
modules/poll/poll.module, строка 230
- Версии
- 5
poll_menu(
$may_cache)- 6
poll_menu()
Реализация hook_menu()
.
Код
<?php
function poll_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array('path' => 'poll', 'title' => t('Polls'),
'callback' => 'poll_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'poll/vote',
'title' => t('Vote'),
'callback' => 'poll_vote',
'access' => user_access('vote on polls'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'poll/cancel',
'title' => t('Cancel'),
'callback' => 'poll_cancel',
'access' => user_access('cancel own vote'),
'type' => MENU_CALLBACK);
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'poll') .'/poll.css');
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'poll') {
$items[] = array('path' => 'node/'. arg(1) .'/votes',
'title' => t('Votes'),
'callback' => 'poll_votes',
'access' => user_access('inspect all votes'),
'weight' => 3,
'type' => MENU_LOCAL_TASK);
}
if ($node->type == 'poll' && $node->allowvotes) {
$items[] = array('path' => 'node/'. arg(1) .'/results',
'title' => t('Results'),
'callback' => 'poll_results',
'access' => user_access('access content'),
'weight' => 3,
'type' => MENU_LOCAL_TASK);
}
}
}
return $items;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии