'DMSDocument'
);
function updateCMSFields(FieldList $fields){
// Document listing
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldFilterHeader(),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
//GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d')
);
$modelClass = DMS::$modelClass;
$gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields)
->setFieldCasting(array('LastChanged'=>"Date->Ago"))
->setFieldFormatting(array('FilenameWithoutID'=>'$FilenameWithoutID'));
$gridField = GridField::create(
'Documents',
false,
$this->owner->Documents(),
$gridFieldConfig
);
$uploadBtn = new LiteralField(
'UploadButton',
sprintf(
'%s',
Controller::join_links(singleton('DMSDocumentAddController')->Link(), '?ID=' . $this->owner->ID),
"Add Document"
)
);
$fields->addFieldsToTab(
'Root.Documents',
array(
$uploadBtn,
$gridField
)
);
}
}