From 50275801c95a392804dc7918b0425beb3441191d Mon Sep 17 00:00:00 2001 From: AlexeyDsov Date: Mon, 17 Sep 2012 12:33:50 +0400 Subject: [PATCH] added to methods Form::(markMissing|markWrong|markGood) optional argument "label" to set it without calling special method --- core/Form/Form.class.php | 14 ++++++++++---- doc/ChangeLog | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/Form/Form.class.php b/core/Form/Form.class.php index b4c9077823..f94abc892e 100644 --- a/core/Form/Form.class.php +++ b/core/Form/Form.class.php @@ -120,9 +120,9 @@ public function disableImportFiltering() /** * @return Form **/ - public function markMissing($primitiveName) + public function markMissing($primitiveName, $label = null) { - return $this->markCustom($primitiveName, Form::MISSING); + return $this->markCustom($primitiveName, Form::MISSING, $label); } /** @@ -130,7 +130,7 @@ public function markMissing($primitiveName) * * @return Form **/ - public function markWrong($name) + public function markWrong($name, $label = null) { if (isset($this->primitives[$name])) $this->errors[$name] = self::WRONG; @@ -141,6 +141,9 @@ public function markWrong($name) $name.' does not match known primitives or rules' ); + if ($label !== null) + $this->addWrongLabel($name, $label); + return $this; } @@ -166,12 +169,15 @@ public function markGood($primitiveName) * * @return Form **/ - public function markCustom($primitiveName, $customMark) + public function markCustom($primitiveName, $customMark, $label = null) { Assert::isInteger($customMark); $this->errors[$this->get($primitiveName)->getName()] = $customMark; + if ($label !== null) + $this->addCustomLabel($primitiveName, $customMark, $label); + return $this; } //@} diff --git a/doc/ChangeLog b/doc/ChangeLog index a074ceb798..2bb285d138 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2012-09-26 Alexey S. Denisov + + * core/Form/Form.class.php: + added to Form methods markMissing, markWrong, markCustom + optional argument "label" to set it without calling special method add*Label + 2012-09-19 Evgeny V. Kokovikhin * main/Monitoring/PinbedMemcached.class.php: cosmetics