ILIAS  release_8 Revision v8.24
ilGSProviderFactory Class Reference

Class ilGSProviderFactory. More...

+ Inheritance diagram for ilGSProviderFactory:
+ Collaboration diagram for ilGSProviderFactory:

Public Member Functions

 __construct (Container $dic)
 @inheritDoc More...
 
 getMainBarProvider ()
 @inheritDoc More...
 
 getMetaBarProvider ()
 @inheritDoc More...
 
 getToolProvider ()
 @inheritDoc More...
 
 getModificationProvider ()
 @inheritDoc More...
 
 getNotificationsProvider ()
 @inheritDoc More...
 
 getToastsProvider ()
 @inheritDoc More...
 
 getMainBarItemInformation ()
 @inheritDoc More...
 
 getProviderByClassName (string $class_name)
 @inheritDoc More...
 
 isInstanceCreationPossible (string $class_name)
 @inheritDoc More...
 
 isRegistered (string $class_name)
 @inheritDoc More...
 
 getModificationProvider ()
 
 getMainBarProvider ()
 
 getMainBarItemInformation ()
 
 getToolProvider ()
 
 getMetaBarProvider ()
 
 getNotificationsProvider ()
 
 getProviderByClassName (string $class_name)
 
 isInstanceCreationPossible (string $class_name)
 
 isRegistered (string $class_name)
 

Protected Member Functions

 registerInternal (array $providers)
 

Protected Attributes

array $all_providers
 
ilComponentRepository $component_repository
 
ilComponentFactory $component_factory
 

Private Member Functions

 initPlugins ()
 
 appendCore (array &$array_of_providers, string $interface)
 

Private Attributes

array $plugin_provider_collections = null
 
array $class_loader
 
Container $dic
 
ItemInformation $main_menu_item_information
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGSProviderFactory::__construct ( Container  $dic)

@inheritDoc

@noRector

Definition at line 57 of file class.ilGSProviderFactory.php.

58 {
59 $this->dic = $dic;
60 $this->main_menu_item_information = new ilMMItemInformation();
62 $this->class_loader = include "Services/GlobalScreen/artifacts/global_screen_providers.php";
63 $this->component_repository = $dic["component.repository"];
64 $this->component_factory = $dic["component.factory"];
65 }
Class ilMMItemInformation.

References $dic.

Member Function Documentation

◆ appendCore()

ilGSProviderFactory::appendCore ( array &  $array_of_providers,
string  $interface 
)
private
Parameters
array$array_of_providers
string$interface

Definition at line 234 of file class.ilGSProviderFactory.php.

234 : void
235 {
236 foreach ($this->class_loader[$interface] ?? [] as $class_name) {
237 if ($this->isInstanceCreationPossible($class_name)) {
238 try {
239 $array_of_providers[] = new $class_name($this->dic);
240 } catch (Throwable $e) {
241 }
242 }
243 }
244 }
isInstanceCreationPossible(string $class_name)
@inheritDoc

References Vendor\Package\$e, and isInstanceCreationPossible().

Referenced by getMainBarProvider(), getMetaBarProvider(), getModificationProvider(), getNotificationsProvider(), getToastsProvider(), and getToolProvider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMainBarItemInformation()

ilGSProviderFactory::getMainBarItemInformation ( )

◆ getMainBarProvider()

ilGSProviderFactory::getMainBarProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 97 of file class.ilGSProviderFactory.php.

97 : array
98 {
99 $providers = [];
100 // Core
101 $this->appendCore($providers, StaticMainMenuProvider::class);
102
103 // Plugins
104 $this->initPlugins();
105 foreach ($this->plugin_provider_collections as $collection) {
106 $provider = $collection->getMainBarProvider();
107 if ($provider) {
108 $providers[] = $provider;
109 }
110 }
111
112 $this->registerInternal($providers);
113
114 return $providers;
115 }
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
$provider
Definition: ltitoken.php:83

References $provider, appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getMetaBarProvider()

ilGSProviderFactory::getMetaBarProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 120 of file class.ilGSProviderFactory.php.

120 : array
121 {
122 $providers = [];
123 // Core
124 $this->appendCore($providers, StaticMetaBarProvider::class);
125
126 // Plugins
127 $this->initPlugins();
128 foreach ($this->plugin_provider_collections as $collection) {
129 $provider = $collection->getMetaBarProvider();
130 if ($provider) {
131 $providers[] = $provider;
132 }
133 }
134
135 $this->registerInternal($providers);
136
137 return $providers;
138 }

References $provider, appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getModificationProvider()

ilGSProviderFactory::getModificationProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 166 of file class.ilGSProviderFactory.php.

166 : array
167 {
168 $providers = [];
169 // Core
170 $this->appendCore($providers, ModificationProvider::class);
171
172 // Plugins
173 $this->initPlugins();
174 foreach ($this->plugin_provider_collections as $collection) {
175 $provider = $collection->getModificationProvider();
176 if ($provider) {
177 $providers[] = $provider;
178 }
179 }
180
181 return $providers;
182 }

References $provider, appendCore(), and initPlugins().

+ Here is the call graph for this function:

◆ getNotificationsProvider()

ilGSProviderFactory::getNotificationsProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 187 of file class.ilGSProviderFactory.php.

187 : array
188 {
189 $providers = [];
190 // Core
191 $this->appendCore($providers, NotificationProvider::class);
192
193 // Plugins
194 $this->initPlugins();
195 foreach ($this->plugin_provider_collections as $collection) {
196 $provider = $collection->getNotificationProvider();
197 if ($provider) {
198 $providers[] = $provider;
199 }
200 }
201
202 $this->registerInternal($providers);
203
204 return $providers;
205 }

References $provider, appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getProviderByClassName()

ilGSProviderFactory::getProviderByClassName ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 257 of file class.ilGSProviderFactory.php.

257 : Provider
258 {
259 if (!$this->isInstanceCreationPossible($class_name) || !$this->isRegistered($class_name)) {
260 throw new LogicException("the GlobalScreen-Provider $class_name is not available");
261 }
262
263 return $this->all_providers[$class_name];
264 }
isRegistered(string $class_name)
@inheritDoc

References isInstanceCreationPossible(), and isRegistered().

+ Here is the call graph for this function:

◆ getToastsProvider()

ilGSProviderFactory::getToastsProvider ( )

@inheritDoc

Definition at line 210 of file class.ilGSProviderFactory.php.

210 : array
211 {
212 $providers = [];
213 // Core
214 $this->appendCore($providers, ToastProvider::class);
215
216 // Plugins
217 $this->initPlugins();
218 foreach ($this->plugin_provider_collections as $collection) {
219 $provider = $collection->getToastProvider();
220 if ($provider) {
221 $providers[] = $provider;
222 }
223 }
224
225 $this->registerInternal($providers);
226
227 return $providers;
228 }

References $provider, appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getToolProvider()

ilGSProviderFactory::getToolProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 143 of file class.ilGSProviderFactory.php.

143 : array
144 {
145 $providers = [];
146 // Core
147 $this->appendCore($providers, DynamicToolProvider::class);
148
149 // Plugins
150 $this->initPlugins();
151 foreach ($this->plugin_provider_collections as $collection) {
152 $provider = $collection->getToolProvider();
153 if ($provider) {
154 $providers[] = $provider;
155 }
156 }
157
158 $this->registerInternal($providers);
159
160 return $providers;
161 }

References $provider, appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ initPlugins()

ilGSProviderFactory::initPlugins ( )
private

Definition at line 67 of file class.ilGSProviderFactory.php.

67 : void
68 {
69 if (!is_array($this->plugin_provider_collections)) {
70 $this->plugin_provider_collections = [];
71 foreach ($this->component_repository->getPlugins() as $plugin) {
72 if (!$plugin->isActive()) {
73 continue;
74 }
75 $pl = $this->component_factory->getPlugin($plugin->getId());
76 $this->plugin_provider_collections[] = $pl->getGlobalScreenProviderCollection();
77 }
78 }
79 }

References XapiProxy\$plugin.

Referenced by getMainBarProvider(), getMetaBarProvider(), getModificationProvider(), getNotificationsProvider(), getToastsProvider(), and getToolProvider().

+ Here is the caller graph for this function:

◆ isInstanceCreationPossible()

ilGSProviderFactory::isInstanceCreationPossible ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 269 of file class.ilGSProviderFactory.php.

269 : bool
270 {
271 try {
272 return class_exists($class_name);
273 } catch (Throwable $e) {
274 return false;
275 }
276 }

References Vendor\Package\$e.

Referenced by appendCore(), and getProviderByClassName().

+ Here is the caller graph for this function:

◆ isRegistered()

ilGSProviderFactory::isRegistered ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 281 of file class.ilGSProviderFactory.php.

281 : bool
282 {
283 return isset($this->all_providers[$class_name]);
284 }

Referenced by getProviderByClassName().

+ Here is the caller graph for this function:

◆ registerInternal()

ilGSProviderFactory::registerInternal ( array  $providers)
protected
Parameters
array$providers

Definition at line 84 of file class.ilGSProviderFactory.php.

84 : void
85 {
86 array_walk(
87 $providers,
88 function (Provider $item): void {
89 $this->all_providers[get_class($item)] = $item;
90 }
91 );
92 }

Referenced by getMainBarProvider(), getMetaBarProvider(), getNotificationsProvider(), getToastsProvider(), and getToolProvider().

+ Here is the caller graph for this function:

Field Documentation

◆ $all_providers

array ilGSProviderFactory::$all_providers
protected

Definition at line 49 of file class.ilGSProviderFactory.php.

◆ $class_loader

array ilGSProviderFactory::$class_loader
private

Definition at line 43 of file class.ilGSProviderFactory.php.

◆ $component_factory

ilComponentFactory ilGSProviderFactory::$component_factory
protected

Definition at line 52 of file class.ilGSProviderFactory.php.

◆ $component_repository

ilComponentRepository ilGSProviderFactory::$component_repository
protected

Definition at line 51 of file class.ilGSProviderFactory.php.

◆ $dic

Container ilGSProviderFactory::$dic
private

Definition at line 44 of file class.ilGSProviderFactory.php.

Referenced by __construct().

◆ $main_menu_item_information

ItemInformation ilGSProviderFactory::$main_menu_item_information
private

Definition at line 45 of file class.ilGSProviderFactory.php.

Referenced by getMainBarItemInformation().

◆ $plugin_provider_collections

array ilGSProviderFactory::$plugin_provider_collections = null
private

Definition at line 42 of file class.ilGSProviderFactory.php.


The documentation for this class was generated from the following file: