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
|
* Create a new class for this field
|
||||||
*/
|
*/
|
||||||
function performReadonlyTransformation() {
|
function performReadonlyTransformation() {
|
||||||
|
|
||||||
$field = new CurrencyField_Readonly($this->name, $this->title, $this->value);
|
$field = new CurrencyField_Readonly($this->name, $this->title, $this->value);
|
||||||
$field -> addExtraClass($this->extraClass());
|
$field -> addExtraClass($this->extraClass());
|
||||||
return $field;
|
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) {
|
function validate($validator) {
|
||||||
@ -71,7 +65,6 @@ class CurrencyField_Readonly extends ReadonlyField{
|
|||||||
if($this->value){
|
if($this->value){
|
||||||
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
||||||
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||||
}
|
}
|
||||||
@ -104,7 +97,6 @@ class CurrencyField_Disabled extends CurrencyField{
|
|||||||
if($this->value){
|
if($this->value){
|
||||||
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
||||||
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user