Example #1
0
 /**
  * Load upload editor
  *
  * @return mixed
  */
 public function load()
 {
     $parameters = $this->getConfig();
     $property = $this->getProperty();
     $upload = new Element\File($this->getName());
     $value = $this->getValue();
     $upload->setLabel($property->getName());
     $upload->setAttribute('class', 'form-control')->setAttribute('id', $this->getName());
     if (!empty($parameters['is_multiple'])) {
         $upload->setAttribute('multiple', 'multiple');
         $upload->setName($upload->getName());
     }
     $hiddenUpload = new Element\Hidden($this->getName() . '-hidden');
     if (!empty($value)) {
         $hiddenUpload->setValue($value);
     }
     return array($upload, $hiddenUpload, $this->addPath(__DIR__)->render('upload-editor.phtml', array('files' => $value, 'id' => $this->getName(), 'isMultiple' => $parameters['is_multiple'])));
 }