mirror of
https://github.com/flarum/core.git
synced 2025-07-20 00:01:17 +02:00
Add API to allow skeleton to customise the Application instance
This commit is contained in:
@@ -42,6 +42,11 @@ abstract class AbstractServer
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var callable[]
|
||||
*/
|
||||
protected $registerCallbacks = [];
|
||||
|
||||
/**
|
||||
* @param null $basePath
|
||||
* @param null $publicPath
|
||||
@@ -128,6 +133,14 @@ abstract class AbstractServer
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callback
|
||||
*/
|
||||
public function register(callable $callback)
|
||||
{
|
||||
$this->registerCallbacks[] = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application
|
||||
*/
|
||||
@@ -179,6 +192,11 @@ abstract class AbstractServer
|
||||
$app->register('Flarum\Api\ApiServiceProvider');
|
||||
$app->register('Flarum\Forum\ForumServiceProvider');
|
||||
$app->register('Flarum\Admin\AdminServiceProvider');
|
||||
|
||||
foreach ($this->registerCallbacks as $callback) {
|
||||
$callback($app);
|
||||
}
|
||||
|
||||
$app->register('Flarum\Extension\ExtensionServiceProvider');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user