Permalink
Browse files

adding FileList

  • Loading branch information...
1 parent 8848631 commit 3b65d9e2c9aa169b5198869e06f271ecb36141ac @halkyon halkyon committed Nov 15, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 code/FileList.php
View
@@ -0,0 +1,20 @@
+<?php
+/**
+ * A FormField showing a list of files
+ * @package cms
+ * @subpackage assets
+ */
+class FileList extends TableListField {
+ // bdc: added sort by Title as default behaviour
+ protected $folder;
+ public function __construct($name, $folder) {
+ $this->folder = $folder;
+ parent::__construct($name, "File", array("Title" => "Title", "LinkedURL" => "URL"), "", "Title");
+ $this->Markable = true;
+ }
+
+ public function sourceItems() {
+ return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
+ }
+}
+

0 comments on commit 3b65d9e

Please sign in to comment.