Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
factory.php
1
<?php
2
namespace
Bitrix\Main\Filter
;
3
4
use
Bitrix\Main
;
5
6
class
Factory
7
{
8
protected
static
$methods
=
null
;
9
15
protected
static
function
prepareMethods
()
16
{
17
if
(self::$methods ===
null
)
18
{
19
self::$methods = [];
20
21
$event =
new
Main\Event
(
'main'
,
'OnBuildFilterFactoryMethods'
, []);
22
$event->send();
23
24
foreach
($event->getResults() as $eventResult)
25
{
26
if
($eventResult->getType() != Main\EventResult::SUCCESS)
27
{
28
continue
;
29
}
30
31
$resultParams = $eventResult->getParameters();
32
if
(isset($resultParams[
'callbacks'
]) && is_array($resultParams[
'callbacks'
]))
33
{
34
foreach
($resultParams[
'callbacks'
] as $entityTypeName => $callback)
35
{
36
if
(is_callable($callback))
37
{
38
self::$methods[$entityTypeName] = $callback;
39
}
40
}
41
}
42
}
43
}
44
return
self::$methods
;
45
}
54
public
static
function
createEntityFilter
($entityTypeName, array $settingsParams, array $additionalParams =
null
)
55
{
56
$methods
=
self::prepareMethods
();
57
if
(isset(
$methods
[$entityTypeName]))
58
{
59
$result = call_user_func_array(
$methods
[$entityTypeName], [ $entityTypeName, $settingsParams, $additionalParams ]);
60
if
($result instanceof
Filter
)
61
{
62
return
$result;
63
}
64
}
65
66
throw
new
Main\NotSupportedException
(
67
"Entity type: '{$entityTypeName}' is not supported in current context."
68
);
69
}
70
}
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\Filter\Factory
Definition
factory.php:7
Bitrix\Main\Filter\Factory\$methods
static $methods
Definition
factory.php:8
Bitrix\Main\Filter\Factory\prepareMethods
static prepareMethods()
Definition
factory.php:15
Bitrix\Main\Filter\Factory\createEntityFilter
static createEntityFilter($entityTypeName, array $settingsParams, array $additionalParams=null)
Definition
factory.php:54
Bitrix\Main\Filter\Filter
Definition
filter.php:5
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Main\Filter
Bitrix\Main
modules
main
lib
filter
factory.php
Создано системой
1.10.0