I like to validate my block on save. (And throw error if needed)
Now i could use the page.update:before and parse the content all way through until i found my block-type. But this is not so elegant, kills performance and is pretty prone to failure.
Is there another way. Maybe inherit some block-classes to do it? Or hook some API?
Of course, I have something special in mind. Otherwise kirby will become boring for me.
Inside the Block, i have other blocks and structures which having a slug-field. At the end, i need to check, that all values occur just once.
Hm, in general validation always happens on the field level, so either for the whole blocks fields or for fields inside the block. I can’t really see anything in the block class that would allow you to hook into for validation, although you can have custom block models since 3.6
I tried something similar when I built form blocks for a client project. In the end I couldn’t find an easy solution and just appended name-1, name-2, name-3, … in the controller.
Luckily, you can filter blocks by type, so it wouldn’t be that difficult to find your form blocks. However, the downside of the hook approach is that you would actually have to find out if a page/site/user has a blocks field at all, which is not ideal.