Prompt can now be used to define the button text for file multi
Minor update to checkbox markup
This commit is contained in:
parent
7f502768dc
commit
906a4e65c2
|
|
@ -34,9 +34,9 @@ class FileUpload extends FormWidgetBase
|
|||
//
|
||||
|
||||
/**
|
||||
* @var string Prompt to display if no record is selected.
|
||||
* @var string Prompt text to display for the upload button.
|
||||
*/
|
||||
public $prompt = 'backend::lang.fileupload.default_prompt';
|
||||
public $prompt = null;
|
||||
|
||||
/**
|
||||
* @var int Preview image width
|
||||
|
|
@ -126,7 +126,7 @@ class FileUpload extends FormWidgetBase
|
|||
$this->vars['cssDimensions'] = $this->getCssDimensions();
|
||||
$this->vars['cssBlockDimensions'] = $this->getCssDimensions('block');
|
||||
$this->vars['useCaption'] = $this->useCaption;
|
||||
$this->vars['prompt'] = str_replace('%s', '<i class="icon-upload"></i>', trans($this->prompt));
|
||||
$this->vars['prompt'] = $this->getPromptText();
|
||||
}
|
||||
|
||||
protected function getFileList()
|
||||
|
|
@ -166,6 +166,22 @@ class FileUpload extends FormWidgetBase
|
|||
return $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the escaped and translated prompt text to display according to the type.
|
||||
* @return string
|
||||
*/
|
||||
protected function getPromptText()
|
||||
{
|
||||
if ($this->prompt === null) {
|
||||
$isMulti = ends_with($this->getDisplayMode(), 'multi');
|
||||
$this->prompt = $isMulti
|
||||
? 'backend::lang.fileupload.upload_file'
|
||||
: 'backend::lang.fileupload.default_prompt';
|
||||
}
|
||||
|
||||
return str_replace('%s', '<i class="icon-upload"></i>', e(trans($this->prompt)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CSS dimensions for the uploaded image,
|
||||
* uses auto where no dimension is provided.
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
>
|
||||
|
||||
<!-- Upload Button -->
|
||||
<button type="button" class="btn btn-sm btn-primary oc-icon-upload upload-button">
|
||||
<?= e(trans('backend::lang.fileupload.upload_file')) ?>
|
||||
<button type="button" class="btn btn-sm btn-default oc-icon-upload upload-button">
|
||||
<?= $prompt ?>
|
||||
</button>
|
||||
|
||||
<!-- Existing files -->
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@
|
|||
Allows a user to select from a small set of binary options.
|
||||
|
||||
<div class="checkbox custom-checkbox">
|
||||
<input name="checkbox" value="1" type="checkbox" id="checkbox1">
|
||||
<input name="checkbox" value="1" type="checkbox" id="checkbox1" />
|
||||
<label for="checkbox1">Checkbox</label>
|
||||
</div>
|
||||
|
||||
### Radio
|
||||
|
||||
<div class="radio custom-radio">
|
||||
<input name="radio" value="1" type="radio" id="radio_1">
|
||||
<input name="radio" value="1" type="radio" id="radio_1" />
|
||||
<label for="radio_1">Paris</label>
|
||||
</div>
|
||||
<div class="radio custom-radio">
|
||||
<input checked="checked" name="radio" value="2" type="radio" id="radio_2">
|
||||
<input checked="checked" name="radio" value="2" type="radio" id="radio_2" />
|
||||
<label for="radio_2">Dubai</label>
|
||||
</div>
|
||||
<div class="radio custom-radio">
|
||||
<input name="radio" value="3" type="radio" id="radio_3">
|
||||
<input name="radio" value="3" type="radio" id="radio_3" />
|
||||
<label for="radio_3">New Zealand</label>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue