mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
9b42effeb5
* Remove "small" class from inline edit form for documents * Swap relationeditor GridFieldConfig for record editor to ensure that document sets can be deleted from a page context rather than unlinked (natively) * Fix to ensure that related documents can be autocompleted via partial matching on filename * Add 2 space indentation rule to editorconfig for .js and .scss files
44 lines
915 B
PHP
44 lines
915 B
PHP
<?php
|
|
|
|
class DMSUploadField_ItemHandler extends UploadField_ItemHandler
|
|
{
|
|
private static $allowed_actions = array(
|
|
'delete',
|
|
'edit',
|
|
'EditForm',
|
|
);
|
|
|
|
/**
|
|
* Gets a DMS document by its ID
|
|
*
|
|
* @return DMSDocument
|
|
*/
|
|
public function getItem()
|
|
{
|
|
return DMSDocument::get()->byId($this->itemID);
|
|
}
|
|
|
|
/**
|
|
* @return Form
|
|
*/
|
|
public function EditForm()
|
|
{
|
|
$file = $this->getItem();
|
|
|
|
// Get form components
|
|
$fields = $this->parent->getDMSFileEditFields($file);
|
|
$actions = $this->parent->getDMSFileEditActions($file);
|
|
$validator = $this->parent->getDMSFileEditValidator($file);
|
|
$form = new Form(
|
|
$this,
|
|
__FUNCTION__,
|
|
$fields,
|
|
$actions,
|
|
$validator
|
|
);
|
|
$form->loadDataFrom($file);
|
|
|
|
return $form;
|
|
}
|
|
}
|