ENHANCEMENT: Add treedropdown to select page when adding a document

This commit is contained in:
Andrew O'Neil 2012-08-14 11:37:32 +12:00
parent b6a728dc0e
commit 3af703fa9a
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,13 @@
<?php
class DMSDocumentAddExistingField extends FormField {
class DMSDocumentAddExistingField extends CompositeField {
function __construct($name, $title = null) {
$this->name = $name;
$this->title = ($title === null) ? $name : $title;
parent::__construct(new TreeDropdownField('PageSelector', 'Add from another page', 'SiteTree'));
}
/**
* Force a record to be used as "Parent" for uploaded Files (eg a Page with a has_one to File)
* @param DataObject $record

View File

@ -9,6 +9,9 @@
</h3>
<input class="document-autocomplete text" type="text" placeholder="Search by ID or filename" />
<span>or Add from page</span>
$fieldByName(PageSelector)
</div>
<div class="ss-assetuploadfield">