public function render(ElementInterface $element)
 {
     $view = $this->getView();
     $formLabel = new Helper\FormLabel();
     $formElement = new Helper\FormFile();
     $formElement->setView($view);
     $formErrors = new Helper\FormElementErrors();
     $formErrors->setView($view);
     $html = '<tr>' . '<th align="right">' . $formLabel($element) . '</th>' . '<td width="10px">&nbsp;</td>' . '<td>' . $formElement($element, Escaper\AbstractHelper::RECURSE_ARRAY) . '<span class="form-errors">' . $formErrors($element) . '</span>' . '</td></tr>' . PHP_EOL;
     return $html;
 }
 /**
  * @inheritdoc
  */
 public function render(ElementInterface $element)
 {
     $element->resetOriginalType();
     $output = parent::render($element);
     $escapeHtmlAttrHelper = $this->getView()->plugin('escapeHtmlAttr');
     $serverUrlHelper = $this->getView()->plugin('serverUrl');
     $value = $element->getValue();
     if (!empty($value)) {
         $src = $escapeHtmlAttrHelper($serverUrlHelper() . '/files/' . $value);
         $output = sprintf('<div class="thumbnail col-sm-2"><img src="%s" /></div>', $src) . $output;
     }
     return $output;
 }
Example #3
0
 /**
  * @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;
 }
Example #4
0
 /**
  * Render a form <input> file element from the provided $element,
  * @param  ElementInterface $element
  * @param  null|string $formType
  * @param  array $displayOptions
  * @return string
  */
 public function render(ElementInterface $element, $formType = null, array $displayOptions = array())
 {
     $this->prepareElementBeforeRendering($element, $formType, $displayOptions);
     $html = parent::render($element);
     return $html;
 }
 /**
  * File
  *
  * @param ElementInterface|null $element
  * @return string|Helper\FormInput
  */
 public function file(ElementInterface $element = null)
 {
     $helper = new Helper\FormFile();
     return $helper->__invoke($element);
 }