23480 Posts in 18951 Topics by 2878 members
|Go to End|
7 September 2011 at 3:02pm
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?
7 September 2011 at 8:50pm
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
8 September 2011 at 9:17am
Thanks Will - that's what I'm after. Just couldn't think of the right search terms.
|Go to Top|