function authcache_preprocess_forum_topic_list in Authenticated User Page Caching (Authcache) 6
Same name and namespace in other branches
- 7 authcache.module \authcache_preprocess_forum_topic_list()
Process forum template variables
Remove "new" marker
See also
File
- ./
authcache.module, line 611 - Authenticated User Page Caching (and anonymous users, too!)
Code
function authcache_preprocess_forum_topic_list(&$variables) {
if ($variables['is_page_authcache']) {
if (!empty($variables['topics'])) {
foreach ($variables['topics'] as $id => $topic) {
$nid = $variables['topics'][$id]->nid;
// Replace "new" icons. If you are using custom icons, make sure
// the filenames have the same format as Drupal core
$icon = str_replace('hot-new', 'hot', $variables['topics'][$id]->icon);
$icon = str_replace('new', 'default', $variables['topics'][$id]->icon);
$variables['topics'][$id]->icon = '<span class="authcache-topic-icon" data-nid="' . $nid . '">' . $icon . '</span>';
$variables['topics'][$id]->title .= '<span class="authcache-topic-info" data-timestamp="' . $variables['topics'][$id]->timestamp . '" data-nid="' . $nid . '"></span>';
// "New" reply count will be handle via Ajax
if ($topic->num_comments) {
$variables['topics'][$id]->num_comments .= '<span class="authcache-topic-replies" data-nid="' . $nid . '"></span>';
$variables['topics'][$id]->new_text = '';
$variables['topics'][$id]->new_url = '';
}
}
}
}
}