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.

All other Modules /

Discuss all other Modules here.

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

Kickassets sort order on 2.4


Go to End


3 Posts   1321 Views

Avatar
neilcreagh

Community Member, 136 Posts

23 October 2014 at 5:15am

Note: I realise this question is about an old version of Kickassets running on an old version of the CMS but someone might know a quick fix for this issue that might save me having to upgrade the entire CMS to version 3 just to solve this?

I have a client on SS2.4 with the KickAssets module installed, using a custom sort order for photos added to pages .i.e the _config.php file has

ManyManySortable::add_sortable_many_many_relations(array('Page' => 'Photos'));

The sort order works, but it reverts back to being ordered by name everytime a new file is added.
i.e. adding a new image to a page that already has multiple images set to a custom order will result in the whole list reverting to alphabetical.

When adding a new file, is there any way to leave the custom order set as it is, and just add the new file to the bottom (or top) of this?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

23 October 2014 at 10:16am

It's been a while since I've had my head in this module, but I don't recognise this code at all:

ManyManySortable::add_sortable_many_many_relations(array('Page' => 'Photos'));

What does that come from?

Avatar
neilcreagh

Community Member, 136 Posts

23 October 2014 at 11:03am

Edited: 23/10/2014 10:56pm

Just looking back at these comments from 2012: http://www.leftandmain.com/silverstripe-modules/2011/08/25/kickassets/#comment-1012
It looks like I added that line to my config file in order to get MultipleFileAttachmentField to work. So this might be the issue - any idea? Is there another/better way to enable manual sort ordering?

I appreciate that you may not want to look through old/outdated code but if you have any ideas let me know, thanks

(ps. I can't get that link above to work)