Hello. I try to override some quicktabs before it will be rendered on page.
at template.php
function mythemename_preprocess_node(&$vars) {
//set comment count and put it in $comment_count_node
$comment_count_node = $vars['node']->comment_count;
variable_set('comment_count_node', $vars['node']->comment_count);
}
function mythemename_quicktabs_alter(&$quicktabs) {
if ($quicktabs->machine_name == 'product_tabs') {
$comment_count = variable_get('comment_count_node', '0');
$quicktabs->tabs[1]['title'] = t('Reviews').' ('.$comment_count.')';
}
}
It works only on second refresh page. Also, if i have, for example,
2 nodes with 1 comments(node1) and 5 comments(node2), and f5 first node1, then node2, then again node1 - it show 5 comment count.
What I am doing wrong?
Comments
Comment #1
makkon commentedbump, probably it is likely due to incorrect variable use, because t('Reviews').' (X)'; with such construction it will bring me every time Reviews (X)
Comment #2
smustgrave commentedWith D7 EOL approaching in a month I'm starting to triage the D7 side of quicktabs queue. This doesn't appear to have any code so believe this may not make it, sorry! Thanks though!
If still an issue or needed for 4.0.x (latest branch) feel free to reopen