icon.php 573 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. $entity = elgg_extract("entity", $vars);
  3. $size = elgg_extract("size", $vars);
  4. if (isset($vars["override"]) && $vars["override"] == true) {
  5. $override = true;
  6. } else {
  7. $override = false;
  8. }
  9. $allowed_sizes = array("tiny", "small", "medium");
  10. if (!in_array($size, $allowed_sizes)) {
  11. $size = "small";
  12. }
  13. $icon = elgg_view("output/img", array(
  14. "src" => $entity->getIconUrl($size),
  15. "alt" => $entity->title,
  16. "title" => $entity->title
  17. ));
  18. if (!$override) {
  19. echo "<a href='" . $entity->getURL() . "' class='icon'>";
  20. echo $icon;
  21. echo "</a>";
  22. } else {
  23. echo $icon;
  24. }