public function getIconURL(ElggEntity $entity, $params = array())
{
if (is_array($params)) {
$size = elgg_extract('size', $params, 'medium');
} else {
$size = is_string($params) ? $params : 'medium';
$params = array();
}
$size = elgg_strtolower($size);
$params['entity'] = $entity;
$params['size'] = $size;
$type = elgg_extract('type', $params) ?: 'icon';
$entity_type = $entity->getType();
$url = $this->hooks->trigger("entity:{$type}:url", $entity_type, $params, null);
if ($url == null) {
if ($this->hasIcon($entity, $size, $type)) {
$icon = $this->getIcon($entity, $size, $type);
$url = elgg_get_inline_url($icon, true);
} else {
$url = $this->getFallbackIconUrl($entity, $params);
}
}
if ($url) {
return elgg_normalize_url($url);
}
}