silverstripe-dms/code/cms/DMSUploadField_ItemHandler.php
Robbie Averill 9b42effeb5 FIX Refactor SCSS, convert to more BEM-like names, add admin icon
* 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
2017-05-22 15:20:16 +12:00

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;
}
}