Elgg\EntityIconService::deleteIcon PHP Метод

deleteIcon() публичный Метод

Removes all icon files and metadata for the passed type of icon.
public deleteIcon ( ElggEntity $entity, string $type = 'icon' ) : boolean
$entity ElggEntity Entity that owns icons
$type string The name of the icon. e.g., 'icon', 'cover_photo'
Результат boolean
    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);
        }
    }