Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
dataprovider.php
1<?php
2
4
7
8abstract class DataProvider
9{
10 private array $actions;
11 private ?Settings $settings;
12
16 public function __construct(?Settings $settings = null)
17 {
18 $this->settings = $settings;
19 }
20
26 final protected function getSettings(): Settings
27 {
28 return $this->settings;
29 }
30
38 final protected function getActionById(string $id): ?Action
39 {
40 if (empty($id))
41 {
42 return null;
43 }
44
45 if (!isset($this->actions))
46 {
47 $this->actions = [];
48
49 foreach ($this->prepareActions() as $action)
50 {
51 $this->actions[$action::getId()] = $action;
52 }
53 }
54
55 return $this->actions[$id] ?? null;
56 }
57
61 abstract public function prepareActions(): array;
62
70 public function prepareControls(array $rawFields): array
71 {
72 $result = [];
73
74 foreach ($this->prepareActions() as $actionsItem)
75 {
76 $actionConfig = $actionsItem->getControl($rawFields);
77 if (isset($actionConfig))
78 {
79 $result[] = $actionConfig;
80 }
81 }
82
83 return $result;
84 }
85}
__construct(?Settings $settings=null)