mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-06-26 06:29:26 +02:00
Linking to page in DMSDoc detail view, adding header
This commit is contained in:
parent
02fad50ab3
commit
2d66b0e453
|
@ -348,6 +348,12 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||||
parent::delete();
|
parent::delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relate an existing file on the filesystem to the document.
|
||||||
|
* Copies the file to the new destination, as defined in {@link get_DMS_path()}.
|
||||||
|
*
|
||||||
|
* @param String Path to file, relative to webroot.
|
||||||
|
*/
|
||||||
function storeDocument($filePath) {
|
function storeDocument($filePath) {
|
||||||
if (empty($this->ID)) user_error("Document must be written to database before it can store documents",E_USER_ERROR);
|
if (empty($this->ID)) user_error("Document must be written to database before it can store documents",E_USER_ERROR);
|
||||||
|
|
||||||
|
@ -445,16 +451,28 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||||
$UploadField->setConfig('allowedMaxFileNumber', 1);
|
$UploadField->setConfig('allowedMaxFileNumber', 1);
|
||||||
|
|
||||||
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
|
new GridFieldToolbarHeader(),
|
||||||
new GridFieldSortableHeader(),
|
new GridFieldSortableHeader(),
|
||||||
new GridFieldDataColumns(),
|
new GridFieldDataColumns(),
|
||||||
new GridFieldPaginator(30),
|
new GridFieldPaginator(30),
|
||||||
//new GridFieldEditButton(),
|
//new GridFieldEditButton(),
|
||||||
new GridFieldDetailForm()
|
new GridFieldDetailForm()
|
||||||
);
|
);
|
||||||
$gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title'=>'Title','ClassName'=>'Page Type','ID'=>'Page ID'));
|
$gridFieldConfig->getComponentByType('GridFieldDataColumns')
|
||||||
|
->setDisplayFields(array(
|
||||||
|
'Title'=>'Title',
|
||||||
|
'ClassName'=>'Page Type',
|
||||||
|
'ID'=>'Page ID'
|
||||||
|
))
|
||||||
|
->setFieldFormatting(array(
|
||||||
|
'Title'=>sprintf(
|
||||||
|
'<a class=\"cms-panel-link\" href=\"%s/$ID\">$Title</a>',
|
||||||
|
singleton('CMSPageEditController')->Link('show')
|
||||||
|
)
|
||||||
|
));
|
||||||
$pagesGrid = GridField::create(
|
$pagesGrid = GridField::create(
|
||||||
'Pages',
|
'Pages',
|
||||||
false,
|
_t('DMSDocument.RelatedPages', 'Related Pages'),
|
||||||
$this->Pages(),
|
$this->Pages(),
|
||||||
$gridFieldConfig
|
$gridFieldConfig
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user