You are here

function _authcache_poll in Authenticated User Page Caching (Authcache) 7

Same name and namespace in other branches
  1. 6 ajax/authcache.php \_authcache_poll()

Get poll results/form for user Response will be cached.

See also

poll.module

File

ajax/authcache.php, line 239
Authcache Ajax Callback (authcache.php)

Code

function _authcache_poll($vars) {

  // FULL bootstrap required in case custom theming is used
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  $node = node_load($vars['nid']);
  $build = node_view($node);
  if (isset($build['poll_view_voting'])) {
    $output = render($build['poll_view_voting']);
  }
  elseif (isset($build['poll_view_results'])) {
    $output = render($build['poll_view_results']);
  }
  return array(
    'nid' => $vars['nid'],
    'html' => $output,
  );
}