Skip to content

Commit

Permalink
Update readme for composer and example image
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancox committed Nov 24, 2016
1 parent db2fab2 commit b5525f8
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ SilverStripe 3.0+
Installation Instructions
-------------------------

1. Place the files in a directory called "sortableuploadfield" in the root of your SilverStripe installation
2. Visit yoursite.com/dev/build
Via composer:

```
composer require nathancox/sortableuploadfield
```

Or manually download the module and place it in a folder in your site root.

Visit yoursite.com/dev/build


Usage
Expand All @@ -45,6 +52,32 @@ class SlideshowImage extends Image {
}
```

And in the page:

```php
...

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

![example sortableuploadfield](http://static.flyingmonkey.co.nz/github/silverstripe-sortableuploadfield/sortableuploadfield-1.png)


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


Expand Down

0 comments on commit b5525f8

Please sign in to comment.