| @@ 42-47 (lines=6) @@ | ||
| 39 | public function getAll(): array |
|
| 40 | { |
|
| 41 | $widgets = []; |
|
| 42 | if (\App\Cache::has('Widgets', $this->moduleName)) { |
|
| 43 | $widgetsData = \App\Cache::get('Widgets', $this->moduleName); |
|
| 44 | } else { |
|
| 45 | $widgetsData = \App\Api::getInstance()->call("{$this->moduleName}/Widgets") ?: []; |
|
| 46 | \App\Cache::save('Widgets', $this->moduleName, $widgetsData, \App\Cache::LONG); |
|
| 47 | } |
|
| 48 | foreach ($widgetsData as $widgetData) { |
|
| 49 | if (!\in_array($widgetData['type'], ['RelatedModule', 'Updates', 'Comments'])) { |
|
| 50 | continue; |
|
| @@ 135-140 (lines=6) @@ | ||
| 132 | */ |
|
| 133 | public function getFieldsFromApi(): array |
|
| 134 | { |
|
| 135 | if (\App\Cache::has('moduleFields', $this->moduleName)) { |
|
| 136 | $data = \App\Cache::get('moduleFields', $this->moduleName); |
|
| 137 | } else { |
|
| 138 | $data = Api::getInstance()->call($this->moduleName . '/Fields'); |
|
| 139 | \App\Cache::save('moduleFields', $this->moduleName, $data); |
|
| 140 | } |
|
| 141 | return $data; |
|
| 142 | } |
|
| 143 | ||