function _sna_blocks_resultset_add_count in Simple Node Archive Blocks 7.2
Format views results to add year, month and count.
Parameters
array $archive: Array contain views result.
Return value
array An associate arrry.
1 call to _sna_blocks_resultset_add_count()
- _sna_blocks_preprocess_sna_blocks in theme/
sna_blocks.theme.inc - @file The theme system, which controls the output of simple node archive.
File
- theme/
sna_blocks.theme.inc, line 111 - The theme system, which controls the output of simple node archive.
Code
function _sna_blocks_resultset_add_count($archive) {
// Adding count field.
if (!empty($archive)) {
foreach ($archive as $year => $month) {
$year_count = 0;
foreach ($month as $key => $title) {
$count = count($title, COUNT_RECURSIVE);
$archive[$year][$key . ' (' . $count . ')'] = $archive[$year][$key];
unset($archive[$year][$key]);
$year_count += $count;
}
$archive[$year . ' (' . $year_count . ')'] = $archive[$year];
unset($archive[$year]);
}
}
return $archive;
}