`page->update()` won't work inside hook

Give me a sec … no.
But I found out another thing:

After updating as shown above, I’m downloading an image from external source, and then I’m doing this:

                if ($downloaded) {
                    $page->image($fileName . '.jpg')->update(['template' => 'image']);
                    $page->update(['cover' => $fileName . '.jpg']);
                }

… and if I comment out this last update, everything works as expected …

Would be great if this was base functionality, you know - having a button field that let’s you do stuff like @bnomei does with kirby-janitor …

i suggest you file an issue if updateing a page by code does not work in a page.update:after hook. i would have expected it to work even if it will loop if no escape route is coded.

1 Like