Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions core/Form/Form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ 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);
}

/**
* rule or primitive
*
* @return Form
**/
public function markWrong($name)
public function markWrong($name, $label = null)
{
if (isset($this->primitives[$name]))
$this->errors[$name] = self::WRONG;
Expand All @@ -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;
}

Expand All @@ -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;
}
//@}
Expand Down
6 changes: 6 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down