Make prompt text configurable
This commit is contained in:
parent
362acf63d6
commit
94ae0b7cbc
|
|
@ -31,6 +31,11 @@ class FileUpload extends FormWidgetBase
|
||||||
// Configurable properties
|
// Configurable properties
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Prompt to display if no record is selected.
|
||||||
|
*/
|
||||||
|
public $prompt = 'Click the %s or drag a file here to upload';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Preview image width
|
* @var int Preview image width
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,6 +84,7 @@ class FileUpload extends FormWidgetBase
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->fillFromConfig([
|
$this->fillFromConfig([
|
||||||
|
'prompt',
|
||||||
'imageWidth',
|
'imageWidth',
|
||||||
'imageHeight',
|
'imageHeight',
|
||||||
'previewNoFilesMessage',
|
'previewNoFilesMessage',
|
||||||
|
|
@ -113,6 +119,7 @@ class FileUpload extends FormWidgetBase
|
||||||
$this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
|
$this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
|
||||||
$this->vars['cssDimensions'] = $this->getCssDimensions();
|
$this->vars['cssDimensions'] = $this->getCssDimensions();
|
||||||
$this->vars['useCaption'] = $this->useCaption;
|
$this->vars['useCaption'] = $this->useCaption;
|
||||||
|
$this->vars['prompt'] = str_replace('%s', '<i class="icon-upload"></i>', $this->prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFileList()
|
protected function getFileList()
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
<!-- Empty message -->
|
<!-- Empty message -->
|
||||||
<div class="upload-empty-message">
|
<div class="upload-empty-message">
|
||||||
<span class="text-muted">Click the <i class="icon-upload"></i> or drag a file here to upload</span>
|
<span class="text-muted"><?= $prompt ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue