/**
  * Renders new file input field with value. Applicable for edit action.
  *
  * @param  Table $table Table
  * @param  string $field Field
  * @param  array $options Options
  * @param  mixed $data Data
  * @return string HTML input field with data attribute.
  */
 protected function _renderInputWithData($table, $field, $data, $options)
 {
     $fileUploadsUtils = new FileUploadsUtils($table);
     $entities = $fileUploadsUtils->getFiles($data);
     if (is_null($entities)) {
         return $this->_renderInputWithoutData($table, $field, $options);
     }
     $files = [];
     foreach ($entities as $file) {
         $files[] = ['id' => $file->id, 'path' => $file->path];
     }
     $uploadField = $this->cakeView->Form->file($this->_getFieldName($table, $field, $options) . '[]', ['multiple' => true, 'data-document-id' => $data, 'data-files' => json_encode($files)]);
     $label = $this->cakeView->Form->label($field);
     return sprintf(self::WRAPPER, $label, $uploadField);
 }
 /**
  * {@inheritDoc}
  */
 public function renderValue($table, $field, $data, array $options = [])
 {
     $result = null;
     $defaultOptions = ['imageSize' => getenv('DEFAULT_IMAGE_SIZE')];
     $data = $this->_getFieldValueFromData($field, $data);
     if (empty($data) && !empty($options['entity'])) {
         $data = $this->_getFieldValueFromData('id', $options['entity']);
     }
     if (empty($data)) {
         return $result;
     }
     $fileUploadsUtils = new FileUploadsUtils($table);
     $entities = $fileUploadsUtils->getFiles($table, $field, $data);
     if (!empty($entities)) {
         $result = $this->_thumbnailsHtml($entities, $fileUploadsUtils, $defaultOptions);
     }
     return $result;
 }
 /**
  * {@inheritDoc}
  */
 public function renderValue($table, $field, $data, array $options = [])
 {
     $result = null;
     $data = $this->_getFieldValueFromData($field, $data);
     if (empty($data) && !empty($options['entity'])) {
         $data = $this->_getFieldValueFromData('id', $options['entity']);
     }
     if (empty($data)) {
         return $result;
     }
     $fileUploadsUtils = new FileUploadsUtils($table);
     $entities = $fileUploadsUtils->getFiles($table, $field, $data);
     if (!empty($entities)) {
         $result = $this->_filesHtml($entities, $fileUploadsUtils);
     }
     return $result;
 }