I've been looking for an event that get triggered when an entry is moved from a disabled to enabled status.
Currently I'm trying to find it through the EVENT_AFTER_SAVE_ELEMENT
event but I have no idea what the previous status of the entry was so I can't tell if it was just updated:
current
Event::on(
Elements::class,
Elements::EVENT_AFTER_SAVE_ELEMENT,
function(Event $event)
{
$element = $event->element;
// Get the status, but I don't know the previous status.
$status = $element->status;
}
);
I also had this pointed out to me https://docs.craftcms.com/api/v3/craft-events-setstatusevent.html but I don't know what emits this event as a parameter.