Developer: Actions

Broadcast offers several actions which can be hooked into. All actions are based off of the Plainview SDK’s WordPress Action class, which means that the parameter is an object that is passed around.

All of the actions can be found in the src/actions directory. The name of the actions are prefixed with threewp_broadcast_. For example, the file src/actions/broadcasting_started.php provides the threewp_broadcast_broadcasting_started action.

The source code of the actions themselves should be documented enough to be self-explanatory.

Finish

The Action class offers two methods that could / should be used to signal to hooks that the action has been fully applied / completed / finished.

$action->finish();

and

$action->is_finished();

Generally, if an executed action modifies something, after which no other hook should do anything, call the finish() method. Logically, when receiving the action yourself, check is_finished().

 

Leave a Reply

Your email address will not be published. Required fields are marked *