2012-08-21 04:21:23 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Extends the original toolbar with document picking capability - modified lines are commented.
|
|
|
|
*/
|
2015-12-17 19:48:37 +01:00
|
|
|
class DocumentHtmlEditorFieldToolbar extends Extension
|
|
|
|
{
|
|
|
|
public 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['document'] = 'Download a document';
|
|
|
|
$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
|
|
|
|
2017-08-07 01:21:35 +02:00
|
|
|
$fieldList->push(HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey()));
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
2015-12-17 19:48:37 +01:00
|
|
|
//return $form;
|
|
|
|
}
|
|
|
|
}
|