Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ImageDataObjectManager as a selector

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1037 Views
  • davidfsmith
    Avatar
    Community Member
    5 Posts

    ImageDataObjectManager as a selector Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: ImageDataObjectManager as a selector Link to this post

    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.

  • davidfsmith
    Avatar
    Community Member
    5 Posts

    Re: ImageDataObjectManager as a selector Link to this post

    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 ?

  • UncleCheese
    Avatar
    4085 Posts

    Re: ImageDataObjectManager as a selector Link to this post

    Why not just use a TreeDropdownField?

    new TreeDropdownField('MyImageID','','Image');

  • davidfsmith
    Avatar
    Community Member
    5 Posts

    Re: ImageDataObjectManager as a selector Link to this post

    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.

    ;-)

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