Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » has_many Images

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2687 Views
  • xmedeko
    Avatar
    Community Member
    94 Posts

    has_many Images Link to this post

    Hi,

    I have a Slideshow, which has many Images. (Particularly, Slideshow has_many SlideshowImage, and SlideshowImage has_one Image). The ImageField does not work with has_many relationship. What is the best way to have some has_many image chooser for CMS?

    Thanks very much
    Andy

  • Nathan Cox
    Avatar
    Community Member
    99 Posts

    Re: has_many Images Link to this post

    Maybe I'm misunderstanding, but why do you need has_many images? Wouldn't you make a lot of SlideshowImage objects and give each one a single image?

    The Slideshow would then have a relationship to each SlideshowImage, but not directly to any actual images..

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: has_many Images Link to this post

    The SlideshowImage has 'Sort' field, holding an information about the order of images in the slideshow. So, the link from Slideshow to Image is indirect through SlideshowImage.

    I got it working, if I fill values in MySQL manually My main problem is to make some nice multiple image chooser in the CMS.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: has_many Images Link to this post

    Currently no such form control exists, unfortunately. You'd need to create a class similar to ImageField yourself. If you manage to get this sort us, let us know how you get on.

    2687 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.