Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Allowing checkbox for certain page types to act as "featured" item


Go to End


4 Posts   1722 Views

Avatar
ck_bullet

Community Member, 16 Posts

4 August 2010 at 7:05am

I would like a CMS user to be able to mark one certain page type "featured". I'm assuming in the model you would add a field to the $db array called something like 'IsFeatured' => 'Boolean' and make the default value 'false'. Then you would add a new checkboxfield somewhere within the Root.Content.Main tab. But I only want at most one item in the entire site to be marked as a featured item. So how would I make sure that when I save that any previously marked item is deselected? And I need to differentiate between saving Live and for Draft as well, correct?

Avatar
ck_bullet

Community Member, 16 Posts

26 August 2010 at 4:27am

Still trying to figure this out, anyone have any ideas? Is there some onSave method where you can add custom functionality to the default CMS behavior?

Avatar
biapar

Forum Moderator, 435 Posts

26 August 2010 at 11:26pm

You need a custom attribute

Avatar
ck_bullet

Community Member, 16 Posts

27 August 2010 at 3:37am