Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
abstractconfigfield.php
1
<?php
2
3
namespace
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config
;
4
5
6
abstract
class
AbstractConfigField
implements
IConfigField
7
{
8
protected
const
URL_PATTERN
=
'%^((https://)|(www\.)|(http://))([a-z0-9-].?)+(:[0-9]+)?(/.*)?$%i'
;
9
10
protected
abstract
static
function
checkValueFields
($value) : bool;
11
12
protected
static
function
getFields
() : array
13
{
14
return
[
'enabled'
];
15
}
16
17
protected
static
function
filter
(array $values)
18
{
19
$fields = static::getFields();
20
return
array_filter($values,
function
($key) use ($fields) {
21
return
in_array($key,$fields);
22
},ARRAY_FILTER_USE_KEY);
23
}
24
25
protected
static
function
setDefaultFields
($value)
26
{
27
return
$value;
28
}
29
30
protected
static
function
setEnabled
($value)
31
{
32
$value[
'enabled'
] =
true
;
33
return
$value;
34
}
35
static
function
prepareValue
($value)
36
{
37
if
(is_array($value))
38
{
39
if
(!static::checkEnabled($value))
40
{
41
return
static::filter(static::setDefaultFields(static::setEnabled($value)));
42
}
43
elseif($value[
'enabled'
])
44
{
45
return
$value;
46
}
47
}
48
return
static::getDefaultValue();
49
}
53
static
function
getDefaultValue
()
54
{
55
return
(static::required() ? [
'enabled'
=>
false
] :
null
);
56
}
57
58
protected
static
function
checkEnabled
($value) : bool
59
{
60
return
array_key_exists(
'enabled'
,$value) && is_bool($value[
'enabled'
]);
61
}
65
static
function
checkValue
($value): bool
66
{
67
if
(!isset($value) && !static::required())
68
{
69
return
true
;
70
}
71
elseif(is_array($value) && static::checkEnabled($value))
72
{
73
return
(!$value[
'enabled'
]?
true
: static::checkValueFields($value));
74
}
75
return
false
;
76
}
77
}
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField
Definition
abstractconfigfield.php:7
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\getDefaultValue
static getDefaultValue()
Definition
abstractconfigfield.php:53
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\checkValue
static checkValue($value)
Definition
abstractconfigfield.php:65
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\filter
static filter(array $values)
Definition
abstractconfigfield.php:17
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\URL_PATTERN
const URL_PATTERN
Definition
abstractconfigfield.php:8
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\checkValueFields
static checkValueFields($value)
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\prepareValue
static prepareValue($value)
Definition
abstractconfigfield.php:35
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\getFields
static getFields()
Definition
abstractconfigfield.php:12
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\setDefaultFields
static setDefaultFields($value)
Definition
abstractconfigfield.php:25
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\checkEnabled
static checkEnabled($value)
Definition
abstractconfigfield.php:58
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField\setEnabled
static setEnabled($value)
Definition
abstractconfigfield.php:30
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\IConfigField
Definition
iconfigfield.php:8
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config
Definition
abstractconfigfield.php:3
modules
seo
lib
businesssuite
configuration
facebook
fields
config
abstractconfigfield.php
Создано системой
1.10.0