I am looking to attach multiple images to a page in silverstripe (that will act as a rotating gallery eventually) and was wondering if it was possible for a user to add a link for each of these images when uploading each image?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. This can be achieved by having a
has_manyrelationship to a customDataObjectwhich contains an image and a link object in it.In the following example we have a
HomePagethat has ahas_manyrelationship toSlide.Slidecontains anImageandLink.There is some good information on this topic in SilverStripe Lesson 9 –
Working with data relationships – $has_many.
The optional sorting module I use in this example is the SortableGridField.
SilverStripe 3.1
Slide.php
HomePage.php
Layout/HomePage.ss
SilverStripe 2.4
Using DataObjectManager and Uploadify modules:
Slide.php
HomePage.php
Layout/HomePage.ss