You are here

protected function TagadelicCloudBase::sort in Tagadelic 8.3

Parameters

$by_property. The property on which to sort.:

Sorts the tags by given property.

Return value

$this; for chaining.

File

src/TagadelicCloudBase.php, line 70

Class

TagadelicCloudBase
Defines a base TagadelicCloud implementation.

Namespace

Drupal\tagadelic

Code

protected function sort($by_property) {
  if ($by_property == "random") {
    $this
      ->drupal()
      ->shuffle($this->tags);
  }
  else {

    //Bug in PHP https://bugs.php.net/bug.php?id=50688, lets supress the error.
    @usort($this->tags, array(
      $this,
      "cb_sort_by_{$by_property}",
    ));
  }
  return $this;
}