Trying to update a field (myField) only when the draft page is created with a variable( $myVar). I have other Hooks working but this one keeps throwing an error:
‘Call to a member function update() on null’
Simplified code:
'hooks' => [
'page.create:after' => function ($newPage, $oldPage) {
$myVar="SomeCodeResult";
$newPage->update([
'myField' => $myVar
);
}
],
Anyone any pointers?