Version: current

     1 <?php
     2
     3 class AssetManager extends FileDataObjectManager {
     4
     5     public $default_view = "list";
     6
     7     public function __construct($controller, $name, $sourceClass = "File", $headings = null) {
     8         if($headings === null) {
     9             $headings = array(
    10                     'Title' => 'Title',
    11                     'Filename' => 'Filename'
    12             );
    13         }
    14
    15         $fields = singleton($sourceClass)->getCMSFields();
    16         $fields->removeByName("OwnerID");
    17         $fields->removeByName("Parent");
    18         $fields->removeByName("Filename");
    19         $fields->removeByName("SortOrder");
    20         $fields->removeByName("Sort");
    21         $fields->push(new ReadonlyField('Filename'));
    22         $fields->push(new SimpleTreeDropdownField('ParentID','Folder',"Folder"));
    23         $fields->push(new HiddenField('ID','',$controller->ID));
    24
    25         parent::__construct($controller, $name, $sourceClass, null, $headings, $fields, "Classname != 'Folder'");
    26     }
    27
    28     function FieldHolder() {
    29         if(!$this->controller->ID && $this->controller->ID != 'root')
    30             return "";
    31         return parent::FieldHolder();
    32     }
    33
    34
    35 }
    36
    37 ?>

[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. -