コード例 #1
0
ファイル: FormFile.php プロジェクト: bedi/mfcc-admin-module
 /**
  * @param File $element
  * @return string
  */
 public function render(ElementInterface $element)
 {
     if ($element instanceof File && $element->getFileObject()) {
         $fileObject = $element->getFileObject();
         $fm = FileManager::getInstance();
         $element->setAttribute('class', 'hidden');
         $render = parent::render($element);
         $render .= '<div class="file-container"><div class="file-icon">';
         if ($element instanceof FileImage) {
             $render .= '<img src="' . $this->view->basePath($fm->getThumbImage($fileObject, 64, 64)) . '">';
         } else {
             $render .= '<img src="/img/mfcc-admin-module/file-icons/' . $fileObject->getFileExtension() . '.svg">';
         }
         $render .= '</div><div class="file-info"><strong>' . $fileObject->getName() . '</strong><br><span class="file-size">' . $fileObject->getFormattedSize() . '</span><button type="button" class="btn btn-xs btn-danger file-remove"><i class="fa fa-remove"></i> Remove</button></div></div>';
     } else {
         $render = parent::render($element);
     }
     return $render;
 }