Version: current

     1 <?php
     2 /**
     3  * A FormField showing a list of files
     4  * @package cms
     5  * @subpackage assets
     6  */
     7 class FileList extends TableListField {
     8     // bdc: added sort by Title as default behaviour
     9     protected $folder;
    10     function __construct($name, $folder) {
    11         $this->folder = $folder;
    12         parent::__construct($name, "File", array("Title" => "Title", "LinkedURL" => "URL"), "", "Title");
    13         $this->Markable = true;
    14     }
    15
    16     function sourceItems() {
    17         return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
    18     }
    19 }
    20
    21 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -