2

I wish to create news list where only one can be highlighted. Is it possible to create a checkbox field in my contenttype so that checking it for one element, would cause unchecking it for all the others? As a result I need to have only one element checked throughout the whole list.

contenttypes.yml:

news:
    name: News
    fields:
        titile:
            type: text
        highlight:
            type: checkbox
Maciej Płocki
  • 362
  • 2
  • 7
  • 18

1 Answers1

0

If I understand you correctly, you want to select ONE news item to be highlighted, and only that one item to have highlighted = true (or checked)

Try creating Custom Content Type (call it highlight) using the docs available at https://docs.bolt.cm/3.4/extensions/advanced/fieldtypes then write some code to do the following: if "CurrentNewsItem->highlighted" == true then "find all news with highlighted == true & set highlighted to false"

Disclaimer: I'm new to boltcms myself, so there could be a better way to do this that I dont know (yet)

MichaelHabib
  • 158
  • 7