Sorry, we don't support your browser.  Install a modern browser

Field-level save hooks for side effects

O

Currently there is no straightforward way to deal with fields that should have side effects when saved.

For example, an oembed field that downloads the oembed thumbnail image and stores it on the server (or creates an item in a queue to do this later).

Using the page.update:before hook to check if the field in question is saved is really fragile. It requires knowing the field name and making it work for blocks, nested blocks, layouts with nested blocks… this feels unnecessarily complicated.

Encapsulating most backend field logic, the Form\FieldClass feels like the right place to implement this. But after trying, and Nico’s input on Discord, this is not possible. Kirby commits field values to a changes version which is then published at once.

It would be great if this were taken into account when future work is happening on storage handling and the FieldClass. 💛

3 months ago