Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Are Arrayed CMSFields Possible?

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: 491 Views
  • Tama
    Community Member
    130 Posts

    Are Arrayed CMSFields Possible? Link to this post


    I can't think of the right terminology to search the documentation/ interweb for a solution so I thought I'd ask here.

    I want to extend the Page class so CMS users can upload and place images on a page (which gives us more control over where they place images compared to just inserting them into the HTML editor.)

    Each image would need:
    1. An upload field
    2. A dropdown for placement (i.e. left, right, top, bottom)
    3. A caption

    However I want users to be able to do this for as many images as they want. I could create (for example) 6 groups of image fields but this would look cluttered on the CMS, and there's always the chance a user wants to add 8 images.

    The ideal solution would be to have a tab that creates a new set of fields every time an image is added.

    Is this possible?


  • Willr
    Forum Moderator
    5508 Posts

    Re: Are Arrayed CMSFields Possible? Link to this post

    Well you could represent those fields as a dataobject then attach a has_many relationship between your Page class and that new Dataobject.

    Tutorial 5 covers the basics of dataobjects and relations: http://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-management

  • Tama
    Community Member
    130 Posts

    Re: Are Arrayed CMSFields Possible? Link to this post

    Thanks Will - that's what I'm after. Just couldn't think of the right search terms.

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.