public function getIcon(ElggEntity $entity, $size, $type = 'icon')
{
$size = elgg_strtolower($size);
$params = ['entity' => $entity, 'size' => $size, 'type' => $type];
$entity_type = $entity->getType();
$default_icon = new ElggIcon();
$default_icon->owner_guid = $entity->guid;
$default_icon->setFilename("icons/{$type}/{$size}.jpg");
$icon = $this->hooks->trigger("entity:{$type}:file", $entity_type, $params, $default_icon);
if (!$icon instanceof ElggIcon) {
throw new InvalidParameterException("'entity:{$type}:file', {$entity_type} hook must return an instance of ElggIcon");
}
return $icon;
}