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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

FDOM $allowUploadFolderSelection question


Go to End


3 Posts   1512 Views

Avatar
micahsheets

Community Member, 165 Posts

20 June 2011 at 4:39pm

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;
}

Avatar
schellmax

Community Member, 126 Posts

25 October 2011 at 5:05am

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

Avatar
socks

Community Member, 191 Posts

9 November 2011 at 1:40pm

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;
	}