Getting a record object in afterSave() hook


I need to get the id for a record being saved in a plugin. I’m assuming I’d do this in the after_save hook, but maybe there’s another preferred way?

protected function afterSave($post, $insert){
    // how do I get the object for record being saved?

Thanks – E

The documentation is a bit unclear, but the info you need is in a single $args array:

protected function afterSaveItem($args) {
$record = $args['record']; //the item record being saved
$insert = $args['insert'];


Got it, thanks Patrick!