1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
validator.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Main\ORM\Fields\Validators;
10
11
use Bitrix\Main\ORM;
12
use Bitrix\Main\ArgumentTypeException;
13
use Bitrix\Main\Localization\Loc;
14
15
Loc::loadMessages(__FILE__);
16
17
abstract
class
Validator
implements
ORM\Fields\Validators\IValidator
18
{
22
protected
$errorPhraseCode
=
'MAIN_ENTITY_VALIDATOR'
;
23
protected
$errorPhrase
;
24
29
public
function
__construct
(
$errorPhrase
=
null
)
30
{
31
if
(
$errorPhrase
!==
null
&& !is_string(
$errorPhrase
))
32
{
33
throw
new
ArgumentTypeException
(
'errorPhrase'
,
'string'
);
34
}
35
36
if
(
$errorPhrase
!==
null
)
37
{
38
$this->errorPhrase =
$errorPhrase
;
39
}
40
}
41
50
protected
function
getErrorMessage
($value,
ORM
\
Fields
\
Field
$field,
$errorPhrase
=
null
, $additionalTemplates =
null
)
51
{
52
if
(
$errorPhrase
===
null
)
53
{
54
$errorPhrase
= ($this->errorPhrase !==
null
? $this->errorPhrase : Loc::getMessage($this->errorPhraseCode));
55
}
56
57
$langValues =
array
(
58
'#VALUE#'
=> $value,
59
'#FIELD_NAME#'
=> $field->getName(),
60
'#FIELD_TITLE#'
=> $field->getTitle()
61
);
62
if
(is_array($additionalTemplates))
63
{
64
$langValues += $additionalTemplates;
65
}
66
67
return
str_replace(
68
array_keys($langValues),
69
array_values($langValues),
70
$errorPhrase
71
);
72
}
73
}
Bitrix\Main\ArgumentTypeException
Определения
ArgumentTypeException.php:9
Bitrix\Main\ORM\Fields\Field
Определения
field.php:25
Bitrix\Main\ORM\Fields\Validators\Validator
Определения
validator.php:18
Bitrix\Main\ORM\Fields\Validators\Validator\getErrorMessage
getErrorMessage($value, ORM\Fields\Field $field, $errorPhrase=null, $additionalTemplates=null)
Определения
validator.php:50
Bitrix\Main\ORM\Fields\Validators\Validator\$errorPhraseCode
$errorPhraseCode
Определения
validator.php:22
Bitrix\Main\ORM\Fields\Validators\Validator\$errorPhrase
$errorPhrase
Определения
validator.php:23
Bitrix\Main\ORM\Fields\Validators\Validator\__construct
__construct($errorPhrase=null)
Определения
validator.php:29
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\ORM\Fields\Validators\IValidator
Определения
ivalidator.php:15
Bitrix\Main\ORM\Fields
Определения
arrayfield.php:9
Bitrix\Main\ORM
bitrix
modules
main
lib
orm
fields
validators
validator.php
Создано системой
1.14.0