diff --git a/core/attributedef/AttributePhoneNumber.php b/core/attributedef/AttributePhoneNumber.php new file mode 100644 index 000000000..963e74217 --- /dev/null +++ b/core/attributedef/AttributePhoneNumber.php @@ -0,0 +1,51 @@ +GetOptional('validation_pattern', + '^' . utils::GetConfig()->Get('phone_number_validation_pattern') . '$'); + } + + public static function GetFormFieldClass() + { + return '\\Combodo\\iTop\\Form\\Field\\PhoneField'; + } + + public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) + { + if (empty($sValue)) { + return ''; + } + + $sUrlDecorationClass = utils::GetConfig()->Get('phone_number_decoration_class'); + $sUrlPattern = utils::GetConfig()->Get('phone_number_url_pattern'); + $sUrl = sprintf($sUrlPattern, $sValue); + + return '' . parent::GetAsHTML($sValue) . ''; + } + +} \ No newline at end of file