Jump to:

7939 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » FDOM $allowUploadFolderSelection question

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: 731 Views
  • micahsheets
    Avatar
    Community Member
    164 Posts

    FDOM $allowUploadFolderSelection question Link to this post

    I was looking for a way to disable the File Selection in FDOM. I can see that there is

    protected $allowUploadFolderSelection = true;

    and

    public function allowUploadFolderSelection()
    {
       $this->allowUploadFolderSelection = true;
    }

    However there is not way aside from setting $allowUploadFolderSelection = false; to disable the Folder Selection interface. It would seem that at least on a per instance basis there is no way to disable the Folder Selection on FDOM or IDOM. Of course there may be something I am missing here but shouldn't the function be

    public function disableUploadFolderSelection() {
       $this->allowUploadFolderSelection = falsel;
    }

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: FDOM $allowUploadFolderSelection question Link to this post

    stumbled upon the same issue. will eventually file a pull request on github

  • socks
    Avatar
    Community Member
    190 Posts

    Re: FDOM $allowUploadFolderSelection question Link to this post

    This seems to work for me:

       function getCMSFields() {
          $fields = parent::getCMSFields();
          
          // Slideshow
          $manager = new ImageDataObjectManager(
             $this,             // Controller
             'Slideshow',       // Source name
             'SlideshowImage',    // Source class
             'Attachment',       // File name on DataObject
             array(             // Headings
                            
             ),
             'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
             // Filter clause
             // Sort clause
             // Join clause
          );

          $manager->allowUploadFolderSelection = false;
          $manager->setUploadFolder("Slideshow-Images");
          $fields->addFieldToTab("Root.Content.Slideshow", $manager);

          return $fields;
       }

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