poll_menu

5 poll.module poll_menu($may_cache)
6 poll.module poll_menu()
7 poll.module poll_menu()
8 poll.module poll_menu()

Implementation of hook_menu().

File

modules/poll.module, line 188
Enables your site to capture votes on different topics in the form of multiple choice questions.

Code

function poll_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array(
      'path' => 'node/add/poll', 
      'title' => t('poll'), 
      'access' => user_access('create polls'),
    );
    $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,
    );
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));

      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;
}
Login or register to post comments