set featured_id to 0 if the featured image is deleted

This commit is contained in:
Shish 2023-02-02 16:40:03 +00:00
parent 5ef6268e54
commit 06cba13b8c

View file

@ -71,6 +71,15 @@ class Featured extends Extension
}
}
public function onImageDeletion(ImageDeletionEvent $event)
{
global $config;
if($event->image->id == $config->get_int("featured_id")) {
$config->set_int("featured_id", 0);
$config->save();
}
}
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
{
global $user;