Hello,
I want to use the FileDataObjectManager with a Special Filetype, cause i need some additional functions for the uploaded pdf file.
my DataObject (ResourceFile.php):
class ResourceFile extends DataObject {
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
);
static $has_one = array (
'pdf' => 'PdfFile',
'DocumentsPage' => 'DocumentsPage'
);
public function getCMSFields_forPopup() {
$pdfFile = new FileIFrameField('pdf');
$pdfFile->setAllowedExtensions(array('pdf'));
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
$pdfFile,
);
}
}
DocumentsPage.php:
class DocumentsPage extends Page {
static $has_many = array(
'Documents' => 'ResourceFile'
);
public function getCMSFields() {
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Documentss', // Source name
'ResourceFile', // Source class
'pdf', // File name on DataObject
array(
'Name' => 'Name',
'Description' => 'Description',
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$manager->setBrowseButtonText("Upload (pdf only)");
$manager->setAllowedFileTypes(array('pdf'));
$f->addFieldToTab("Root.Content.Documents",$manager);
return $f;
}
}
class DocumentsPage_Controller extends Page_Controller {
}
Even if i use the following PdfFile.php, i get this error, wenn i try to import a PDF (from Upload folder) in Backend:
class PdfFile extends File {
function BackLinkTracking() {
return false;
}
}
I have no idea what is wrong. Hopefully someone can help me.
Thanks
escaped