mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
- Added support for ExternalKey, LinkedSet, linkedSetIndirect, CaseLog to the new portal
- Fixed some bugs on the customfields integration with he portal SVN:trunk[4003]
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer;
|
||||
|
||||
use \Dict;
|
||||
use \DBObject;
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
|
||||
@@ -61,6 +62,32 @@ abstract class FieldRenderer
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a JSON encoded string that contains the field's validators as an array.
|
||||
*
|
||||
* eg :
|
||||
* {
|
||||
* validator_id_1 : {reg_exp: /[0-9]/, message: "Error message"},
|
||||
* validator_id_2 : {reg_exp: /[a-z]/, message: "Another error message"},
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function GetValidatorsAsJson()
|
||||
{
|
||||
$aValidators = array();
|
||||
foreach ($this->oField->GetValidators() as $oValidator)
|
||||
{
|
||||
$aValidators[$oValidator::GetName()] = array(
|
||||
'reg_exp' => $oValidator->GetRegExp(),
|
||||
'message' => Dict::S($oValidator->GetErrorMessage())
|
||||
);
|
||||
}
|
||||
// - Formatting options
|
||||
return json_encode($aValidators);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a Field as a RenderingOutput
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user