Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Limit amount of DataObjects

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 343 Views
  • kinglozzer
    Avatar
    Community Member
    142 Posts

    Limit amount of DataObjects Link to this post

    Hi all,

    I have a gallery page with an image class that extends DataObject. I want to allow CMS users to add up to 10 images, using the gridfield. How can I impose this limit?

    I guess I could use onBeforeWrite to check the amount that already exist, but surely there's a better way (besides, I'm not confident that would work with the GridFieldBulkEditingTools I'm using).

    Thanks

  • kinglozzer
    Avatar
    Community Member
    142 Posts

    Re: Limit amount of DataObjects Link to this post

    Anyone?

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: Limit amount of DataObjects Link to this post

    Possibly you could try to check the amount of objects for the given page in the objects canCreate() function and return false if the limit has been reached...

    343 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.