2017 © Pedro Peláez
 

library sortableuploadfield

image

nathancox/sortableuploadfield

  • Tuesday, March 6, 2018
  • by nathancox
  • Repository
  • 2 Watchers
  • 9 Stars
  • 927 Installations
  • Scheme
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 2 Open issues
  • 3 Versions
  • 10 % Grown

The README.md

SilverStripe Sortable Upload Field Module

This module creates a subclass of UploadField that allows for sorting the managed files., (*1)

Also changes the upload interface which is heavily inspired by the more complete but use-specific Gallery module (https://github.com/frankmullenger/silverstripe-gallery)., (*2)

Still in development., (*3)

Maintainer

Nathan Cox (nathan@flyingmonkey.co.nz), (*4)

Requirements

SilverStripe 3.0+, (*5)

Installation Instructions

Via composer:, (*6)

composer require nathancox/sortableuploadfield

Or manually download the module and place it in a folder in your site root., (*7)

Visit yoursite.com/dev/build, (*8)

Usage

By default the field will use the File's Sort attribute for sorting. You'll need to make a subclass of File or Image to give it a sort field and $default_sort:, (*9)


class SlideshowImage extends Image { static $default_sort = 'Sort ASC'; static $db = array( 'Sort' => 'Int' ); static $has_one = array( 'Page' => 'Page' ); }

And in the page:, (*10)

    ...

    private static $has_many = array(
        'Slides' => 'SlideshowImage'
    );

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $fields->addFieldToTab('Root.Slides', $field = SortableUploadField::create('Slides', 'Slides'));

        return $fields;
    }

    ...

This will produce, (*11)

example sortableuploadfield, (*12)

You can change the name of the sort attribute with $sortableField->setSortField('SortOrderOrWhatever');, (*13)

Known Issues

Issue Tracker, (*14)

The Versions

06/03 2018

1.0

1.0.0.0

  Sources   Download

24/11 2016

dev-master

9999999-dev

A subclass of UploadField that allows for sorting the managed files.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nathan Cox

cms files silverstripe uploadfield

24/11 2016

1.1.0

1.1.0.0

A subclass of UploadField that allows for sorting the managed files.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nathan Cox

cms files silverstripe uploadfield