ILIAS  release_8 Revision v8.23
ilComponentFactoryImplementation Class Reference
+ Inheritance diagram for ilComponentFactoryImplementation:
+ Collaboration diagram for ilComponentFactoryImplementation:

Public Member Functions

 __construct (\ilComponentRepositoryWrite $component_repository, \ilDBInterface $db)
 
 getPlugin (string $id)
 Get the plugin for the given id. More...
 
 getActivePluginsInSlot (string $slot_id)
 Get the active plugins for the given slot. More...
 

Protected Attributes

ilComponentRepositoryWrite $component_repository
 
ilDBInterface $db
 
array $plugins = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilComponentFactoryImplementation::__construct ( \ilComponentRepositoryWrite  $component_repository,
\ilDBInterface  $db 
)

Definition at line 31 of file class.ilComponentFactoryImplementation.php.

References $component_repository, and $db.

36  {
37  $this->component_repository = $component_repository;
38 
39  // These are only required to pass on to the created objects.
40  $this->db = $db;
41  }

Member Function Documentation

◆ getActivePluginsInSlot()

ilComponentFactoryImplementation::getActivePluginsInSlot ( string  $slot_id)

Get the active plugins for the given slot.

There will only be one instance for a given id in one process, so the instance might be shared among various components.

Returns
<ilPlugin>

Implements ilComponentFactory.

Definition at line 55 of file class.ilComponentFactoryImplementation.php.

References getPlugin().

55  : Generator
56  {
57  $ps = $this->component_repository->getPluginSlotById($slot_id)->getActivePlugins();
58  foreach ($ps as $p) {
59  yield $this->getPlugin($p->getId());
60  }
61  }
getPlugin(string $id)
Get the plugin for the given id.
+ Here is the call graph for this function:

◆ getPlugin()

ilComponentFactoryImplementation::getPlugin ( string  $id)

Get the plugin for the given id.

There will only be one instance for a given id in one process, so the instance might be shared among various components.

Implements ilComponentFactory.

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

References $id, and XapiProxy\$plugin.

Referenced by getActivePluginsInSlot().

43  : ilPlugin
44  {
45  if (!isset($this->plugins[$id])) {
46  $plugin_info = $this->component_repository->getPluginById($id);
47  $class_name = $plugin_info->getClassName();
48  $plugin = new $class_name($this->db, $this->component_repository, $id);
49  $this->plugins[$id] = $plugin;
50  }
51 
52  return $this->plugins[$id];
53  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

Field Documentation

◆ $component_repository

ilComponentRepositoryWrite ilComponentFactoryImplementation::$component_repository
protected

Definition at line 26 of file class.ilComponentFactoryImplementation.php.

Referenced by __construct().

◆ $db

ilDBInterface ilComponentFactoryImplementation::$db
protected

Definition at line 27 of file class.ilComponentFactoryImplementation.php.

Referenced by __construct().

◆ $plugins

array ilComponentFactoryImplementation::$plugins = []
protected

Definition at line 29 of file class.ilComponentFactoryImplementation.php.


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