I'm doing a headless drupal cms.
I need to check the entities before they are deleted. I need to do it globally as the deletion of entities can take place via api (already written) or by using the cms as an administrator.
How can I overwrite the "delete" core operation? I've tried using hooks (hook_entity_predelete / hook_entity_delete) but they don't block delete operation. I need something like this:
if ($condition == true) core_delete() else disable_core_delete()