Only one toggle-field active at once


I am currently working on a news page and learning to use Kirby (and PHP) on-the-go. On the news article page I have the article content and a small preview of the featured article. At first I thought the end-user could just change the featured article by changing tags, but since users are prone to error I won’t be going for that. Now I have a toggle field for each article which tells Kirby if it’s featured or not and based on that I filter the article to show at the “Featured” div. Now, is it possible to somehow define a rule that only one “featured-toggle” button can be active at once? So that when the user forgets to un-toggle the last featured article, toggling a new one just cancels any others.

Thanks in advance

What you could do is use a [page.update:after hook]( that checks if the field value of the toggle field was changed and if so, get the currently featured page from the siblings and update that page.

Thanks a bunch! I ended up just throwing an Exception telling the user to un-feature the last article first, hooks work just perfectly!