Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Widgets /

Discuss SilverStripe Widgets.

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

Slideshow widget


Go to End


10 Posts   8602 Views

Avatar
jpmcc

Community Member, 20 Posts

10 November 2011 at 6:34am

This is exactly what I was looking for. Just a few tweaks:

$options = array();

I changed to :

$options = '<option value="0">Please select an image</option>';

to provide an empty selection, otherwise the first image is already selected, and if it was saved, potentially the wrong image would be saved.

Also just to note that when adding the field to the widget, the image field ID should be specified, so if:

//My Widget

static $has_one = array(
    'MyWidgetImage' => 'Image'
);

//when adding the field

$widgetImageField = new WidgetImageField('MyWidgetImageID', 'My Widget Image');

Cheers for sharing this!

Avatar
bartvanirsel

Community Member, 96 Posts

20 January 2012 at 10:11pm

thanks! old topic but it really helped me out!

Go to Top