Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
prefixnumbergenerator.php
1
<?php
2
namespace
Bitrix\Main\Numerator\Generator
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\Numerator\Generator\Contract\UserConfigurable
;
6
use
Bitrix\Main\Result
;
7
8
Loc::loadMessages
(__FILE__);
9
14
class
PrefixNumberGenerator
extends
NumberGenerator
implements
UserConfigurable
15
{
16
protected
$prefix
;
17
const
TEMPLATE_WORD_PREFIX
=
'PREFIX'
;
18
20
public
function
setConfig
($config)
21
{
22
$this->
setFromArrayOrDefault
(
'prefix'
, $config,
''
);
23
}
24
26
public
function
getConfig
()
27
{
28
return
[
'prefix'
=>
$this->prefix
];
29
}
30
34
public
static
function
getAvailableForType
()
35
{
36
return
'DEFAULT'
;
37
}
38
40
public
function
parseTemplate
($template)
41
{
42
return
str_replace(static::getPatternFor(static::TEMPLATE_WORD_PREFIX), $this->prefix, $template);
43
}
44
46
public
static
function
getTemplateWordsForParse
()
47
{
48
return
[static::getPatternFor(static::TEMPLATE_WORD_PREFIX)];
49
}
50
52
public
static
function
getTemplateWordsSettings
()
53
{
54
return
[
55
static::getPatternFor(static::TEMPLATE_WORD_PREFIX) =>
56
Loc::getMessage
(
'BITRIX_MAIN_NUMERATOR_GENERATOR_PREFIXNUMBERGENERATOR_WORD_PREFIX'
),
57
];
58
}
59
61
public
static
function
getSettingsFields
()
62
{
63
return
[
64
[
65
'settingName'
=>
'prefix'
,
66
'type'
=>
'string'
,
67
'title'
=> static::getPrefixSettingsTitle(),
68
],
69
];
70
}
71
75
protected
static
function
getPrefixSettingsTitle
()
76
{
77
return
Loc::getMessage
(
'TITLE_BITRIX_MAIN_NUMERATOR_GENERATOR_PREFIXNUMBERGENERATOR_PREFIX'
);
78
}
79
81
public
function
validateConfig
($config)
82
{
83
$result =
new
Result
();
84
return
$result;
85
}
86
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\Numerator\Generator\NumberGenerator
Definition
numbergenerator.php:12
Bitrix\Main\Numerator\Generator\NumberGenerator\setFromArrayOrDefault
setFromArrayOrDefault($value, $config, $default=null, $type=null)
Definition
numbergenerator.php:90
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator
Definition
prefixnumbergenerator.php:15
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\$prefix
$prefix
Definition
prefixnumbergenerator.php:16
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\validateConfig
validateConfig($config)
Definition
prefixnumbergenerator.php:81
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getConfig
getConfig()
Definition
prefixnumbergenerator.php:26
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getAvailableForType
static getAvailableForType()
Definition
prefixnumbergenerator.php:34
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getTemplateWordsForParse
static getTemplateWordsForParse()
Definition
prefixnumbergenerator.php:46
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\parseTemplate
parseTemplate($template)
Definition
prefixnumbergenerator.php:40
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getTemplateWordsSettings
static getTemplateWordsSettings()
Definition
prefixnumbergenerator.php:52
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getSettingsFields
static getSettingsFields()
Definition
prefixnumbergenerator.php:61
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\setConfig
setConfig($config)
Definition
prefixnumbergenerator.php:20
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\getPrefixSettingsTitle
static getPrefixSettingsTitle()
Definition
prefixnumbergenerator.php:75
Bitrix\Main\Numerator\Generator\PrefixNumberGenerator\TEMPLATE_WORD_PREFIX
const TEMPLATE_WORD_PREFIX
Definition
prefixnumbergenerator.php:17
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Main\Numerator\Generator\Contract\UserConfigurable
Definition
userconfigurable.php:12
Bitrix\Main\Numerator\Generator
modules
main
lib
numerator
generator
prefixnumbergenerator.php
Создано системой
1.10.0