Issue #2766 - Moves logic to return ReadonlyField versions of MoneyFields child fields to performReadonlyTransformation() method and reverts changes to MoneyField::setReadonly() as per Wilr’s (https://github.com/wilr) request

This commit is contained in:
Joe Harvey 2014-01-13 08:35:40 +00:00
parent 611d571b65
commit 405426799b

View File

@ -120,6 +120,8 @@ class MoneyField extends FormField {
*/
public function performReadonlyTransformation() {
$clone = clone $this;
$clone->fieldAmount = $clone->fieldAmount->performReadonlyTransformation();
$clone->fieldCurrency = $clone->fieldCurrency->performReadonlyTransformation();
$clone->setReadonly(true);
return $clone;
}
@ -131,8 +133,8 @@ class MoneyField extends FormField {
public function setReadonly($bool) {
parent::setReadonly($bool);
$this->fieldAmount = $this->fieldAmount->performReadonlyTransformation();
$this->fieldCurrency = $this->fieldCurrency->performReadonlyTransformation();
$this->fieldAmount->setReadonly($bool);
$this->fieldCurrency->setReadonly($bool);
return $this;
}