You are here

public function TagadelicTag::__ToString in Tagadelic 7.2

Magic method to render the Tag. turns the tag into an HTML link to its source.

File

./TagadelicTag.php, line 36

Class

TagadelicTag
class TagadelicTag TagadelicTag contains the tag itself.

Code

public function __ToString() {
  $this
    ->clean();
  $attributes = $options = array();
  if (!empty($this->description)) {
    $attributes["title"] = $this->description;
  }
  if ($this->weight > 0) {
    $attributes["class"][] = "level{$this->weight}";
  }
  if (!empty($attributes)) {
    $options["attributes"] = $attributes;
  }
  return $this
    ->drupal()
    ->l($this->name, $this->link, $options);
}