mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Code formatting fixes for CurrencyField
This commit is contained in:
parent
fd3de5158d
commit
9cf1686786
@ -37,15 +37,9 @@ class CurrencyField extends TextField {
|
||||
* Create a new class for this field
|
||||
*/
|
||||
function performReadonlyTransformation() {
|
||||
|
||||
$field = new CurrencyField_Readonly($this->name, $this->title, $this->value);
|
||||
$field -> addExtraClass($this->extraClass());
|
||||
return $field;
|
||||
|
||||
/*
|
||||
$this is-a object and cant be passed as_a string of the first parameter of formfield constructor.
|
||||
return new CurrencyField_Readonly($this);
|
||||
*/
|
||||
}
|
||||
|
||||
function validate($validator) {
|
||||
@ -71,9 +65,8 @@ class CurrencyField_Readonly extends ReadonlyField{
|
||||
if($this->value){
|
||||
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
||||
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
||||
|
||||
}else {
|
||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||
} else {
|
||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||
}
|
||||
$valforInput = $this->value ? Convert::raw2att($val) : "";
|
||||
return "<span class=\"readonly ".$this->extraClass()."\" id=\"" . $this->id() . "\">$val</span><input type=\"hidden\" name=\"".$this->name."\" value=\"".$valforInput."\" />";
|
||||
@ -104,9 +97,8 @@ class CurrencyField_Disabled extends CurrencyField{
|
||||
if($this->value){
|
||||
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
||||
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
||||
|
||||
}else {
|
||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||
} else {
|
||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||
}
|
||||
$valforInput = $this->value ? Convert::raw2att($val) : "";
|
||||
return "<input class=\"text\" type=\"text\" disabled=\"disabled\" name=\"".$this->name."\" value=\"".$valforInput."\" />";
|
||||
|
Loading…
Reference in New Issue
Block a user