fixes #1102 limit the number of tags shown in the menubar

This commit is contained in:
plegall
2019-10-15 16:02:14 +02:00
parent c4142c2a51
commit 41b4230b39
3 changed files with 17 additions and 20 deletions
+14
View File
@@ -308,4 +308,18 @@ SELECT *
return query2array($query);
}
function tags_id_compare($a, $b)
{
return ($a['id'] < $b['id']) ? -1 : 1;
}
function tags_counter_compare($a, $b)
{
if ($a['counter'] == $b['counter'])
{
return tags_id_compare($a, $b);
}
return ($a['counter'] < $b['counter']) ? +1 : -1;
}
?>
+2
View File
@@ -138,6 +138,8 @@ function initialize_menu()
else if ($conf['menubar_tag_cloud_content'] == 'always_all' or ($conf['menubar_tag_cloud_content'] == 'all_or_current' and empty($page['items'])) )
{
$tags = get_available_tags();
usort($tags, 'tags_counter_compare');
$tags = array_slice($tags, 0, $conf['menubar_tag_cloud_items_number']);
foreach ($tags as $tag)
{
$block->data[] = array_merge(