mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
BUGFIX: TagCloudWidget sorts by frecuency even with limit equal 0, see ticket 6060
This commit is contained in:
parent
1a6bb1482c
commit
438feba01e
@ -64,12 +64,12 @@ class TagCloudWidget extends Widget {
|
|||||||
|
|
||||||
if($allTags) {
|
if($allTags) {
|
||||||
//TODO: move some or all of the sorts to the database for more efficiency
|
//TODO: move some or all of the sorts to the database for more efficiency
|
||||||
if($this->Limit > 0){
|
if($this->Limit > 0) $allTags = array_slice($allTags, 0, $this->Limit, true);
|
||||||
uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity
|
|
||||||
$allTags = array_slice($allTags, 0, $this->Limit,true);
|
|
||||||
}
|
|
||||||
if($this->Sortby == "alphabet"){
|
if($this->Sortby == "alphabet"){
|
||||||
$this->natksort($allTags);
|
$this->natksort($allTags);
|
||||||
|
} else{
|
||||||
|
uasort($allTags, array($this, "column_sort_by_popularity")); // sort by frequency
|
||||||
}
|
}
|
||||||
|
|
||||||
$sizes = array();
|
$sizes = array();
|
||||||
@ -79,7 +79,7 @@ class TagCloudWidget extends Widget {
|
|||||||
$numsizes = count($sizes)-1; //Work out the number of different sizes
|
$numsizes = count($sizes)-1; //Work out the number of different sizes
|
||||||
$buckets = count(self::$popularities)-1;
|
$buckets = count(self::$popularities)-1;
|
||||||
|
|
||||||
// If there are more frequencies then buckets, divide frequencies into buckets
|
// If there are more frequencies than buckets, divide frequencies into buckets
|
||||||
if ($numsizes > $buckets) {
|
if ($numsizes > $buckets) {
|
||||||
$numsizes = $buckets;
|
$numsizes = $buckets;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user