silverstripe-dms/code/cms/DocumentHtmlEditorFieldToolbar.php

40 lines
1.3 KiB
PHP
Raw Normal View History

2012-08-21 04:21:23 +02:00
<?php
/**
* Extends the original toolbar with document picking capability - modified lines are commented.
*/
class DocumentHtmlEditorFieldToolbar extends Extension {
function updateLinkForm(Form $form) {
$linkType = null;
$fieldList = null;
$fields = $form->Fields();//->fieldByName('Heading');
foreach($fields as $field) {
$linkType = ($field->fieldByName('LinkType'));
$fieldList = $field;
if ($linkType) break; //break once we have the object
}
$source = $linkType->getSource();
$source['documentopt'] = 'Download a document';
2012-08-21 04:21:23 +02:00
$linkType->setSource($source);
$addExistingField = new DMSDocumentAddExistingField('AddExisting', 'Add Existing');
$addExistingField->setForm($form);
$addExistingField->setUseFieldClass(false);
$fieldList->insertAfter($addExistingField,'Description');
2012-08-21 04:21:23 +02:00
// Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
// Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js");
//
// // create additional field, rebase to 'documents' directory
// $documents = new TreeDropdownField('document', 'Document', 'File', 'ID', 'DocumentDropdownTitle', true);
// $documents->setSearchFunction(array($this, 'documentSearchCallback'));
// $baseFolder = Folder::find_or_make(Document::$directory);
// $documents->setTreeBaseID($baseFolder->ID);
//return $form;
}
}