PHP code example of nathancox / sortableuploadfield
1. Go to this page and download the library: Download nathancox/sortableuploadfield library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nathancox / sortableuploadfield example snippets
class SlideshowImage extends Image {
static $default_sort = 'Sort ASC';
static $db = array(
'Sort' => 'Int'
);
static $has_one = array(
'Page' => 'Page'
);
}
...
private static $has_many = array(
'Slides' => 'SlideshowImage'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Slides', $field = SortableUploadField::create('Slides', 'Slides'));
return $fields;
}
...