Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
factory.php
1<?php
2namespace Bitrix\Main\Filter;
3
5
6class 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 {
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
67 "Entity type: '{$entityTypeName}' is not supported in current context."
68 );
69 }
70}
static createEntityFilter($entityTypeName, array $settingsParams, array $additionalParams=null)
Definition factory.php:54