public function load()
{
$parameters = $this->getConfig();
$options = empty($parameters['options']) ? array() : $parameters['options'];
$this->initScript();
$fileList = array();
$files = unserialize($this->getValue());
if (!empty($files)) {
$fileClass = new File();
$fileClass->load($this->getProperty(), $this->getDatatype()->getDocument());
foreach ($files as $fileData) {
$fileObject = array();
$fileObject['name'] = $fileData['value'];
$fileObject['filename'] = $fileData['value'];
$fileObject['thumbnail_url'] = $fileData['value'];
$router = Registry::get('Application')->getMvcEvent()->getRouter();
$fileObject['delete_url'] = $router->assemble(array('document_id' => $this->getDatatype()->getDocument()->getId(), 'property_id' => $this->getProperty()->getId(), 'file' => base64_encode($fileData['value'])), array('name' => 'content/media/remove'));
$fileObject['delete_type'] = 'DELETE';
$fileList[] = $fileObject;
}
}
return $this->addPath(__DIR__)->render('upload-editor.phtml', array('property' => $this->getProperty(), 'uploadUrl' => $this->getUploadUrl(), 'name' => $this->getName(), 'files' => json_encode($fileList), 'options' => $options));
}