FIX: Ensure tag cloud widget does not break when there are zero tags

This commit is contained in:
Gordon Anderson 2016-02-24 22:01:24 +07:00
parent 96d8adebab
commit 515928b8e2

View File

@ -90,11 +90,14 @@ class BlogTagsCloudWidget extends Widget
}
// normalize the tag counts from 1 to 10
if ($maxTagCount) {
$tagfactor = 10 / $maxTagCount;
foreach ($tags->getIterator() as $tag) {
$normalized = round($tagfactor * ($tag->TagCount));
$tag->NormalizedTag = $normalized;
}
}
return $tags;
}