function poll_block_latest_poll_view

cis7 poll.module poll_block_latest_poll_view($node)
cle7 poll.module poll_block_latest_poll_view($node)
elmsmedia7 poll.module poll_block_latest_poll_view($node)
icor7 poll.module poll_block_latest_poll_view($node)
meedjum_blog7 poll.module poll_block_latest_poll_view($node)
mooc7 poll.module poll_block_latest_poll_view($node)

Return content for 'latest poll' block.

Parameters

$node: The node object to load.

1 call to poll_block_latest_poll_view()
poll_block_view in modules/poll/poll.module
Implements hook_block_view().

File

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

Code

function poll_block_latest_poll_view($node) {
  global $user;
  $output = '';

  // This is necessary for shared objects because PHP doesn't copy objects, but
  // passes them by reference.  So when the objects are cached it can result in
  // the wrong output being displayed on subsequent calls.  The cloning and
  // unsetting of $node->content prevents the block output from being the same
  // as the node output.
  $node = clone $node;
  unset($node->content);

  // No 'read more' link.
  $node->readmore = FALSE;
  $node->teaser = '';

  $links = array();
  $links[] = array(
    'title' => t('Older polls'),
    'href' => 'poll',
    'attributes' => array('title' => t('View the list of polls on this site.')),
  );
  if ($node->allowvotes) {
    $links[] = array(
      'title' => t('Results'),
      'href' => 'node/' . $node->nid . '/results',
      'attributes' => array('title' => t('View the current poll results.')),
    );
  }

  $node->links = $links;

  if (!empty($node->allowvotes)) {
    $node->content['poll_view_voting'] = drupal_get_form('poll_view_voting', $node, TRUE);
    $node->content['links'] = array(
      '#theme' => 'links',
      '#links' => $node->links,
      '#weight' => 5,
    );
  }
  else {
    $node->content['poll_view_results'] = array('#markup' => poll_view_results($node, TRUE, TRUE));
  }

  return $node;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.