mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Replaced AssetTableField with GridField in Folder->getCMSFields() (and thereby in AssetAdmin)
This commit is contained in:
parent
24a37daa50
commit
5a0eef5bab
@ -398,30 +398,29 @@ class Folder extends File {
|
|||||||
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$fileList = new AssetTableField(
|
$config = GridFieldConfig::create();
|
||||||
$this,
|
$config->addComponent(new GridFieldFilter());
|
||||||
"Files",
|
$config->addComponent(new GridFieldDefaultColumns());
|
||||||
"File",
|
$config->addComponent(new GridFieldSortableHeader());
|
||||||
array("Title" => _t('Folder.TITLE', "Title"), "Filename" => _t('Folder.FILENAME', "Filename")),
|
$config->addComponent(new GridFieldPaginator(2));
|
||||||
""
|
$config->addComponent(new GridFieldAction_Delete());
|
||||||
);
|
$files = DataList::create('File')->filter('ParentID', $this->ID)->exclude('ClassName', 'Folder');
|
||||||
$fileList->setFolder($this);
|
$gridField = new GridField('File','Files', $files, $config);
|
||||||
$fileList->setPopupCaption(_t('Folder.VIEWEDITASSET', "View/Edit Asset"));
|
$gridField->setDisplayFields(array(
|
||||||
|
'StripThumbnail' => '',
|
||||||
|
'Parent.FileName' => 'Folder',
|
||||||
|
'Title'=>'Title',
|
||||||
|
'Size'=>'Size',
|
||||||
|
));
|
||||||
|
|
||||||
$titleField = ($this->ID && $this->ID != "root") ? new TextField("Title", _t('Folder.TITLE')) : new HiddenField("Title");
|
$titleField = ($this->ID && $this->ID != "root") ? new TextField("Title", _t('Folder.TITLE')) : new HiddenField("Title");
|
||||||
if( $this->canEdit() ) {
|
|
||||||
$deleteButton = new InlineFormAction('deletemarked',_t('Folder.DELSELECTED','Delete selected files'), 'delete');
|
|
||||||
$deleteButton->includeDefaultJS(false);
|
|
||||||
} else {
|
|
||||||
$deleteButton = new HiddenField('deletemarked');
|
|
||||||
}
|
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
new HiddenField("Name"),
|
new HiddenField("Name"),
|
||||||
new TabSet("Root",
|
new TabSet("Root",
|
||||||
new Tab("Files", _t('Folder.FILESTAB', "Files"),
|
new Tab("Files", _t('Folder.FILESTAB', "Files"),
|
||||||
$titleField,
|
$titleField,
|
||||||
$fileList,
|
$gridField,
|
||||||
new HiddenField("DestFolderID")
|
new HiddenField("DestFolderID")
|
||||||
),
|
),
|
||||||
new Tab("Details", _t('Folder.DETAILSTAB', "Details"),
|
new Tab("Details", _t('Folder.DETAILSTAB', "Details"),
|
||||||
|
Loading…
Reference in New Issue
Block a user