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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Custom data object with custom 'Published' field

Go to End

2 Posts   1804 Views


Community Member, 8 Posts

21 May 2013 at 12:36am

Hi all,

I have a problem with a custom dataobject called articles in my clients project.

They want the ability to start writing an article belonging to my custom dataobject but not show it on the front end until they flag it as Published. I have created a custom field in the popup called Published and all is working great accept...

I need to use the Odd and Even page controls to close rows off in the template. However as the items flagged as Unpublished are still counted towards the number of items (I'm using 'if Publsihed' in my template to show/hide).

So, how would I go about removing items in my custom dataobject based on a custom field within it? I'm not too sure if it should be done from the custom dataobject file or the page type that is using it and I'm also not quite sure how it should be done, if it is possible!

Any pointers would be great.

Best regards,


Forum Moderator, 5523 Posts

22 May 2013 at 10:07pm

How have you got your list of objects? You can simply filter that list by published flag.

return Articles::get()->filter(array("Published" => 1));