Element status events extension for Craft CMS.

1.3.0 2019-01-18 19:15 UTC


The Element Status Events extension provides events that are triggered whenever an element’s status changes. It is intended to be used by Craft modules and plugins.

Note that the events are triggered only when elements are saved. An entry that is enabled with a future post date will not automatically trigger the event when the post date is reached. For that functionality, take a look at the Published Event plugin.

To get an understanding of how the extension works, read the Challenge #6 – The Chicken or the Egg solution.


This extension is licensed for free under the MIT License.


This extension requires Craft CMS 3.0.0 or later.


To use the extension, simply require it in your module or plugin’s compose.json file.

"require": {
    "putyourlightson/craft-element-status-events": "^1.3.0"


The module provides the following event.


Triggered whenever an element’s status is changed. The element will have a statusBeforeSave (string) and statusChanged (boolean) parameter available to it.

Event::on(ElementStatusEvents::class, ElementStatusEvents::EVENT_STATUS_CHANGED, function(ElementEvent $event) {
    /** @var Element $element */
    $element = $event->element;
    $oldStatus = $element->statusBeforeSave;
    $newStatus = $element->status;
    $statusChanged = $element->statusChanged;

Created by PutYourLightsOn.