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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

ImageDataObjectManager. How to automatically insert the photo in the top of the list?

Go to End

5 Posts   1357 Views


Community Member, 89 Posts

28 January 2011 at 4:14am

Edited: 28/01/2011 9:02am

I have

class Foto extends DataObject

and in my FotoPage
$manager = new ImageDataObjectManager(
			$this, // Controller
			'Fotos', // Source name
			'Foto', // Source class
			'Attachment', // File name on DataObject
				'Name' => 'Name', 
				'Description' => 'Description'
				//'Category' => 'Category'
			), // Headings 
			'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
			// Filter clause
			// Sort clause
			// Join clause

in my _config.php
I set

How to rearrange photos? Now when I add a Foto, it ceases at the end of the list. How to make it automatically becomes the first?


Forum Moderator, 4102 Posts

28 January 2011 at 9:46am

You can probably just do



Community Member, 89 Posts

28 January 2011 at 10:38pm

but SortableDataObject:: set_sort_dir ("DESC");
change the order of a site,

but the administrative part of it remained as before. How can I change the order for the admin part?


Forum Moderator, 4102 Posts

29 January 2011 at 8:39am

Right. The backend always reflects how the objects will be displayed on the frontend. Otherwise, it would be really confusing!

SilverStripe tips, tutorials, screencasts and more:


Community Member, 89 Posts

3 February 2011 at 3:35am

Please tell if I have two classes.

class Foto extends DataObject ...
class MiniThumbs extends DataObject

For one (Foto) want to change the sorting site.
For the second (MiniThumbs) to leave as it was.

SortableDataObject::Foto:: set_sort_dir ("DESC");
SortableDataObject::MiniThumbs:: set_sort_dir ("DESC");

It can be done?