- 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:
Guillaume Lajarige
2016-04-18 15:07:58 +00:00
parent c9c6b2f7d5
commit 8834e1b49c
15 changed files with 1351 additions and 19 deletions

View File

@@ -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
*