You are here

function authcache_node_view_alter in Authenticated User Page Caching (Authcache) 7

File

./authcache.module, line 458
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_node_view_alter(&$build) {
  global $_authcache_is_cacheable;
  $node = $build['#node'];
  if ($node->type == 'poll' && $_authcache_is_cacheable) {
    if (isset($build['poll_view_voting'])) {
      $build['poll_view_voting'] = array(
        '#markup' => '<span class="authcache-poll" data-nid="' . check_plain($node->nid) . '"></span>',
      );
    }
    if (isset($build['poll_view_results'])) {
      $build['poll_view_results'] = array(
        '#markup' => '<span class="authcache-poll" data-nid="' . check_plain($node->nid) . '"></span>',
      );
    }
  }
  if (isset($build['links']['comment']['#links']['comment-comments'])) {
    $build['links']['comment']['#links']['comment-new-comments'] = array(
      'title' => t('Number of new comments unknown'),
      'attributes' => array(
        'class' => array(
          'authcache-comment-num-new',
        ),
        'data-node-nid' => $node->nid,
      ),
    );
  }
}