How to get new page’s title in page.create:after hook

Tried this (in `config.php`):

‘hooks’ => [
  ‘page.create:after’ => function ($newPage) {
      $newsletterDetails = [
          “name” => $newPage->title()->value(),
          …

but get Call to a member function title() on null in the modal.

How can I get the title in the hook, then?
(Couldn’t find anything helpful here or in the docs.)

Hey,

have a look at the docs. $newPage alone does not work anymore.

Thanks a lot, @David.
‘page.create:after’ => function (Kirby\Cms\Page $page) { … did it.

I guess the mix of old forum posts and current docs confused me.

You are welcome.

i was at the exact same point a few months ago :wink: