|
@@ -38,6 +38,13 @@ class File extends Field implements UploadFieldInterface
|
|
$this->containerId = $this->generateId();
|
|
$this->containerId = $this->generateId();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function setElementName($name)
|
|
|
|
+ {
|
|
|
|
+ $this->mergeOptions(['elementName' => $name]);
|
|
|
|
+
|
|
|
|
+ return parent::setElementName($name);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @return mixed
|
|
* @return mixed
|
|
*/
|
|
*/
|
|
@@ -174,7 +181,7 @@ class File extends Field implements UploadFieldInterface
|
|
|
|
|
|
$this->forceOptions();
|
|
$this->forceOptions();
|
|
$this->formatValue();
|
|
$this->formatValue();
|
|
- $this->setUpScript();
|
|
|
|
|
|
+ $this->addScript();
|
|
|
|
|
|
$this->addVariables([
|
|
$this->addVariables([
|
|
'fileType' => $this->options['isImage'] ? '' : 'file',
|
|
'fileType' => $this->options['isImage'] ? '' : 'file',
|
|
@@ -185,7 +192,7 @@ class File extends Field implements UploadFieldInterface
|
|
return parent::render();
|
|
return parent::render();
|
|
}
|
|
}
|
|
|
|
|
|
- protected function setUpScript()
|
|
|
|
|
|
+ protected function addScript()
|
|
{
|
|
{
|
|
$newButton = trans('admin.uploader.add_new_media');
|
|
$newButton = trans('admin.uploader.add_new_media');
|
|
$options = JavaScript::format($this->options);
|
|
$options = JavaScript::format($this->options);
|
|
@@ -237,10 +244,6 @@ class File extends Field implements UploadFieldInterface
|
|
}, 250);
|
|
}, 250);
|
|
}
|
|
}
|
|
resize();
|
|
resize();
|
|
-
|
|
|
|
- $('[name="file-{$this->getElementName()}"]').change(function () {
|
|
|
|
- uploader.uploader.addFiles(this.files);
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
})();
|
|
})();
|
|
JS;
|
|
JS;
|