mirror of
https://github.com/flarum/core.git
synced 2025-07-20 16:21:18 +02:00
Resolve extenders from ExtensionManager
Loading the activated extensions now means retrieving an array of extenders (classes that implement a certain type of extension of a core feature in Flarum). For now, the only existing extender is the Compat extender which is used to handle old-style bootstrappers that simply return a closure that receives all of its dependencies via auto injection. In the future, extensions will be able to return an array of extender instances from their bootstrapper instead. These extender classes will be implemented in the next step.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
|
||||
class ExtensionServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
@@ -22,13 +23,14 @@ class ExtensionServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
$this->app->bind('flarum.extensions', ExtensionManager::class);
|
||||
|
||||
$bootstrappers = $this->app->make('flarum.extensions')->getEnabledBootstrappers();
|
||||
$this->app->booting(function (Container $app) {
|
||||
/** @var \Flarum\Extend\Extender[] $extenders */
|
||||
$extenders = $app->make('flarum.extensions')->getActiveExtenders();
|
||||
|
||||
foreach ($bootstrappers as $file) {
|
||||
$bootstrapper = require $file;
|
||||
|
||||
$this->app->call($bootstrapper);
|
||||
}
|
||||
foreach ($extenders as $extender) {
|
||||
$extender->apply($app);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user