public function deleteIcon(ElggEntity $entity, $type = 'icon')
{
$delete = $this->hooks->trigger("entity:{$type}:delete", $entity->getType(), ['entity' => $entity], true);
if ($delete === false) {
return;
}
$sizes = array_keys($this->getSizes($entity->getType(), $entity->getSubtype(), $type));
foreach ($sizes as $size) {
$icon = $this->getIcon($entity, $size, $type);
$icon->delete();
}
if ($type == 'icon') {
unset($entity->icontime);
unset($entity->x1);
unset($entity->y1);
unset($entity->x2);
unset($entity->y2);
}
}