ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilGSProviderFactory Class Reference
+ Inheritance diagram for ilGSProviderFactory:
+ Collaboration diagram for ilGSProviderFactory:

Public Member Functions

 __construct (private readonly Container $dic)
 
 getMainBarProvider ()
 
 getFooterProvider ()
 
 getMetaBarProvider ()
 
 getToolProvider ()
 
 getModificationProvider ()
 
 getNotificationsProvider ()
 
 getToastsProvider ()
 
 getMainBarItemInformation ()
 
 getFooterItemInformation ()
 
 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
 
readonly ItemInformation $main_menu_item_information
 
readonly ilFooterCustomItemInformation $footer_item_information
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGSProviderFactory::__construct ( private readonly Container  $dic)

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

References ILIAS\Setup\Artifact\BuildArtifactObjective\PATH().

58  {
59  $this->main_menu_item_information = new ilMMItemInformation();
60  $this->footer_item_information = new ilFooterCustomItemInformation($dic);
62  $this->class_loader = include ilGlobalScreenBuildProviderMapObjective::PATH();
63  $this->component_repository = $this->dic["component.repository"];
64  $this->component_factory = $this->dic["component.factory"];
65  }
Class ilMMItemInformation.
$dic
Definition: result.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ appendCore()

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

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

References isInstanceCreationPossible().

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

235  : void
236  {
237  foreach ($this->class_loader[$interface] ?? [] as $class_name) {
238  if ($this->isInstanceCreationPossible($class_name)) {
239  try {
240  $array_of_providers[] = new $class_name($this->dic);
241  } catch (Throwable) {
242  }
243  }
244  }
245  }
isInstanceCreationPossible(string $class_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFooterItemInformation()

◆ getFooterProvider()

ilGSProviderFactory::getFooterProvider ( )
Returns
StaticFooterProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

References appendCore(), and registerInternal().

113  : array
114  {
115  $providers = [];
116  // Core
117  $this->appendCore($providers, StaticFooterProvider::class);
118 
119  // Plugins
120  // $this->initPlugins();
121  // foreach ($this->plugin_provider_collections as $collection) {
122  // $provider = $collection->getMainBarProvider();
123  // if ($provider) {
124  // $providers[] = $provider;
125  // }
126  // }
127 
128  $this->registerInternal($providers);
129 
130  return $providers;
131  }
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getMainBarItemInformation()

ilGSProviderFactory::getMainBarItemInformation ( )
Returns
ItemInformation

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

References $main_menu_item_information.

◆ getMainBarProvider()

ilGSProviderFactory::getMainBarProvider ( )
Returns
StaticMainMenuProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

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

93  : array
94  {
95  $providers = [];
96  // Core
97  $this->appendCore($providers, StaticMainMenuProvider::class);
98 
99  // Plugins
100  $this->initPlugins();
101  foreach ($this->plugin_provider_collections as $collection) {
102  $provider = $collection->getMainBarProvider();
103  if ($provider) {
104  $providers[] = $provider;
105  }
106  }
107 
108  $this->registerInternal($providers);
109 
110  return $providers;
111  }
$provider
Definition: ltitoken.php:80
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getMetaBarProvider()

ilGSProviderFactory::getMetaBarProvider ( )
Returns
StaticMetaBarProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

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

134  : array
135  {
136  $providers = [];
137  // Core
138  $this->appendCore($providers, StaticMetaBarProvider::class);
139 
140  // Plugins
141  $this->initPlugins();
142  foreach ($this->plugin_provider_collections as $collection) {
143  $provider = $collection->getMetaBarProvider();
144  if ($provider) {
145  $providers[] = $provider;
146  }
147  }
148 
149  $this->registerInternal($providers);
150 
151  return $providers;
152  }
$provider
Definition: ltitoken.php:80
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getModificationProvider()

ilGSProviderFactory::getModificationProvider ( )
Returns
ModificationProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

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

175  : array
176  {
177  $providers = [];
178  // Core
179  $this->appendCore($providers, ModificationProvider::class);
180 
181  // Plugins
182  $this->initPlugins();
183  foreach ($this->plugin_provider_collections as $collection) {
184  $provider = $collection->getModificationProvider();
185  if ($provider) {
186  $providers[] = $provider;
187  }
188  }
189 
190  return $providers;
191  }
$provider
Definition: ltitoken.php:80
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getNotificationsProvider()

ilGSProviderFactory::getNotificationsProvider ( )
Returns
NotificationProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

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

193  : array
194  {
195  $providers = [];
196  // Core
197  $this->appendCore($providers, NotificationProvider::class);
198 
199  // Plugins
200  $this->initPlugins();
201  foreach ($this->plugin_provider_collections as $collection) {
202  $provider = $collection->getNotificationProvider();
203  if ($provider) {
204  $providers[] = $provider;
205  }
206  }
207 
208  $this->registerInternal($providers);
209 
210  return $providers;
211  }
$provider
Definition: ltitoken.php:80
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getProviderByClassName()

ilGSProviderFactory::getProviderByClassName ( string  $class_name)
Parameters
string$class_name
Returns
Provider

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

References isInstanceCreationPossible(), and isRegistered().

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)
isInstanceCreationPossible(string $class_name)
+ Here is the call graph for this function:

◆ getToastsProvider()

ilGSProviderFactory::getToastsProvider ( )

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

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

214  : array
215  {
216  $providers = [];
217  // Core
218  $this->appendCore($providers, ToastProvider::class);
219 
220  // Plugins
221  $this->initPlugins();
222  foreach ($this->plugin_provider_collections as $collection) {
223  $provider = $collection->getToastProvider();
224  if ($provider) {
225  $providers[] = $provider;
226  }
227  }
228 
229  $this->registerInternal($providers);
230 
231  return $providers;
232  }
$provider
Definition: ltitoken.php:80
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ getToolProvider()

ilGSProviderFactory::getToolProvider ( )
Returns
DynamicToolProvider[]

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

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

155  : array
156  {
157  $providers = [];
158  // Core
159  $this->appendCore($providers, DynamicToolProvider::class);
160 
161  // Plugins
162  $this->initPlugins();
163  foreach ($this->plugin_provider_collections as $collection) {
164  $provider = $collection->getToolProvider();
165  if ($provider) {
166  $providers[] = $provider;
167  }
168  }
169 
170  $this->registerInternal($providers);
171 
172  return $providers;
173  }
$provider
Definition: ltitoken.php:80
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)
+ Here is the call graph for this function:

◆ initPlugins()

ilGSProviderFactory::initPlugins ( )
private

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

References XapiProxy\$plugin.

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

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  }
+ Here is the caller graph for this function:

◆ isInstanceCreationPossible()

ilGSProviderFactory::isInstanceCreationPossible ( string  $class_name)
Parameters
string$class_name
Returns
bool

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

Referenced by appendCore(), and getProviderByClassName().

267  : bool
268  {
269  try {
270  return class_exists($class_name);
271  } catch (Throwable) {
272  return false;
273  }
274  }
+ Here is the caller graph for this function:

◆ isRegistered()

ilGSProviderFactory::isRegistered ( string  $class_name)
Parameters
string$class_name
Returns
bool

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

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

Referenced by getProviderByClassName().

277  : bool
278  {
279  return isset($this->all_providers[$class_name]);
280  }
+ Here is the caller graph for this function:

◆ registerInternal()

ilGSProviderFactory::registerInternal ( array  $providers)
protected

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

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

82  : void
83  {
84  array_walk(
85  $providers,
86  function (Provider $item): void {
87  $this->all_providers[$item::class] = $item;
88  }
89  );
90  }
+ 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.

◆ $footer_item_information

readonly ilFooterCustomItemInformation ilGSProviderFactory::$footer_item_information
private

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

Referenced by getFooterItemInformation().

◆ $main_menu_item_information

readonly ItemInformation ilGSProviderFactory::$main_menu_item_information
private

Definition at line 44 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: