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

Adding a file manager to the Image Gallery


Go to End


1242 Views

Avatar
MarcusDalgren

Community Member, 288 Posts

2 August 2009 at 2:08pm

Hello.

I have been trying to add a file manager to the image gallery so that my client can link files to an album in the same way that images get linked to an album.

I have gotten it to the point where my image resource is linked to the imagegallerypage and to an imagegalleryalbum, adding files to different albums works but I can't use the filter the way you do in the imagegallerymanager.

I stole the lines

$manager->setFilter('AlbumID','Choose an album', $this->Albums()->toDropdownMap('ID','AlbumName'));	
if($this->Albums()->Count() > 0)
	$manager->filter = "AlbumID_".$this->Albums()->First()->ID;

but the last line that sets the filter property makes the page load fail. The error I get is "Missing argument 2 for DataObjectManager::setFilter()".
Everything works if I add $this->Albums()->First()->ID as the last argument to setFilter() so I have no idea why it fails when I add it the way you do in the ImageGalleryManager.