Elgg  Version 3.0
DefinitionLoader.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Di;
6 
13 
17  protected $plugins;
18 
24  public function __construct(Plugins $plugins) {
25  $this->plugins = $plugins;
26  }
27 
32  public function getDefinitions() {
33  // add core services
34  $sources = [
35  Paths::elgg() . 'engine/services.php',
36  Paths::project() . 'elgg-services.php',
37  ];
38 
39  $plugins = $this->plugins->find('active');
40 
41  foreach ($plugins as $plugin) {
42  $plugin->autoload(); // make sure all classes are loaded
43  $sources[] = $plugin->getPath() . 'elgg-services.php';
44  }
45 
46  return array_filter($sources, function($source) {
47  return is_file($source) && is_readable($source);
48  });
49  }
50 }
static project()
Get the project root (where composer is installed) path with "/".
Definition: Paths.php:25
$plugin
$source
static elgg()
Get the Elgg codebase path with "/".
Definition: Paths.php:44
getDefinitions()
Returns a list of definition files.
__construct(Plugins $plugins)
Constructor.
DI definition loader.
Persistent, installation-wide key-value storage.
Definition: Plugins.php:36