7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » ImageDataObjectManager as a selector
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 952 Views |
-
ImageDataObjectManager as a selector

1 June 2010 at 3:49am
Ok, so I'm trying to use the ImageDataObjectManager or some such to select an image from images already uploaded through the CMS.
Each page in my site can have a different background image and I'd like to enable the site admins to be able to choose the image for the page, the images have been uploaded into a separate dir using file / image upload within the CMS, so now I'd like to extend each page to have one imageID. In the CMS I'd use ImageDataObjectManager to show the images from the background directory and allow the user to select and save the image.
So I've got the ImageDataObjectManager showing, and I can add images, either from the directory, or by uploading, but can't work out how I can disable the add button, and just show images from a directory, and then allow the user to select an image to be the background, any pointers or help appreciated.
-
Re: ImageDataObjectManager as a selector

1 June 2010 at 11:39am
Well you can add a "canCreate()" function that returns false for the dataobject you're using. Or just use setPermissions() on your DOM and pass an array of only the permissions you want enabled, e.g. $my_dom->setPermissions(array('edit','delete'));
Sounds to me, however, that if you want only one image associated with the page, your best best is HasOneFileDataObjectManager, not ImageDataObjectManager.
-
Re: ImageDataObjectManager as a selector

2 June 2010 at 9:09am
Thanks for the quick response, is there not a way you can just select an image from the gallery and have that stored ?
Also any doco for HasOneFileDataObjectManager ?
-
Re: ImageDataObjectManager as a selector

2 June 2010 at 9:20am
Why not just use a TreeDropdownField?
new TreeDropdownField('MyImageID','','Image');
-
Re: ImageDataObjectManager as a selector

2 June 2010 at 9:27am
No reason not to use a dropdown, just figure that for the end user being able to see the images and easily select the image they want for the background makes sense, after all a picture paints a thousand words.
;-)
| 952 Views | ||
|
Page:
1
|
Go to Top |

