silverstripe-dms/code/DMSSiteTreeExtension.php
Normann Lou ed6a697b57 APICHANGE: use static $modelClass for DMS, instead of pass through a classname when getting a DMS instance.
FEATURE: add the "Documents" tab to page CMS fields, make the displayed fields customisable by DMSDocument subclass
2012-07-27 15:42:08 +12:00

23 lines
556 B
PHP

<?php
class DMSSiteTreeExtension extends DataExtension {
static $belongs_many_many = array(
'Documents' => 'DMSDocument'
);
function updateCMSFields(&$fields){
$documentsListConfig = GridFieldConfig_RecordEditor::create();
$modelClass = DMS::$modelClass;
$documentsListConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields);
$fields->addFieldToTab(
'Root.Documents',
GridField::create(
'Documents',
false,
$this->owner->Documents(),
$documentsListConfig
)
);
}
}