Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
widgetmanager.php
1<?php
2
4
5use Bitrix\Report\VisualConstructor\BaseWidgetHandler;
9
14class WidgetManager extends Base
15{
16 private static $widgetsList = array();
17 private static $indices = array(
18 'widgetClassName' => array()
19 );
20 private static $called = false;
21
25 protected function getEventTypeKey()
26 {
27 return Common::EVENT_WIDGET_COLLECT;
28 }
29
30
34 public function getWidgetList()
35 {
36 return $this->isCalled() ? self::$widgetsList : false;
37 }
38
42 public function getIndices()
43 {
44 return $this->isCalled() ? self::$indices : false;
45 }
46
51 public function call()
52 {
53 if (!self::$called)
54 {
56 $widgets = $this->getResult();
57 foreach ($widgets as $key => $widget)
58 {
59 self::$widgetsList[$key] = $widget;
60 self::$indices['widgetClassName'][$widget::getClassName()][] = $key;
61 }
62 }
63 self::$called = true;
64 }
65
66
70 private function isCalled()
71 {
72 if (!self::$called)
73 {
74 $this->errors[] = new Error('invoke call method manager before get some parameters');
75 return false;
76 }
77 else
78 {
79 return true;
80 }
81 }
82
83}