poll_view

Versions
4.6 – 4.7
poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE)
5 – 6
poll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE)
7
poll_view($node, $build_mode = 'full')

Implementation of hook_view().

Parameters

$block An extra parameter that adapts the hook to display a block-ready rendering of the poll.

Code

modules/poll.module, line 452

<?php
function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
  global $user;
  $output = '';

  // Special display for side-block
  if ($block) {
    // No 'read more' link
    $node->body = $node->teaser = '';

    $links = module_invoke_all('link', 'node', $node, 1);
    $links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.')));
    if ($node->allowvotes && $block) {
      $links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.')));
    }

    $node->links = $links;
  }

  if ($node->allowvotes && ($block || arg(2) != 'results')) {
    $output .= poll_view_voting($node, $teaser, $page, $block);
  }
  else {
    $output .= poll_view_results($node, $teaser, $page, $block);
  }

  $node->body = $node->teaser = $output;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.