fix: add view namespaces before resolving

Allows `replaceNamespace()` extender to actually remove old routes.
This commit is contained in:
David Wheatley 2021-12-14 10:46:44 +00:00
parent 256ba64a40
commit 3d46ead14b
No known key found for this signature in database
GPG Key ID: DCC0FCE349280DFF
5 changed files with 14 additions and 11 deletions

View File

@ -29,6 +29,7 @@ use Flarum\Locale\LocaleManager;
use Flarum\Settings\Event\Saved;
use Illuminate\Contracts\Container\Container;
use Laminas\Stratigility\MiddlewarePipe;
use Illuminate\Contracts\View\Factory as ViewFactory;
class AdminServiceProvider extends AbstractServiceProvider
{
@ -121,9 +122,9 @@ class AdminServiceProvider extends AbstractServiceProvider
/**
* {@inheritdoc}
*/
public function boot()
public function boot(ViewFactory $views)
{
$this->loadViewsFrom(__DIR__.'/../../views', 'flarum.admin');
$views->addNamespace('flarum.admin', __DIR__.'/../../views');
$events = $this->container->make('events');

View File

@ -33,7 +33,7 @@ use Flarum\Settings\Event\Saving;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\Factory as ViewFactory;
use Laminas\Stratigility\MiddlewarePipe;
use Symfony\Contracts\Translation\TranslatorInterface;
@ -131,11 +131,11 @@ class ForumServiceProvider extends AbstractServiceProvider
});
}
public function boot(Container $container, Dispatcher $events, Factory $view)
public function boot(Container $container, Dispatcher $events, ViewFactory $views)
{
$this->loadViewsFrom(__DIR__.'/../../views', 'flarum.forum');
$views->addNamespace('flarum.forum', __DIR__.'/../../views');
$view->share([
$views->share([
'translator' => $container->make(TranslatorInterface::class),
'settings' => $container->make(SettingsRepositoryInterface::class)
]);

View File

@ -144,7 +144,7 @@ class FrontendServiceProvider extends AbstractServiceProvider
*/
public function boot(Container $container, ViewFactory $views)
{
$this->loadViewsFrom(__DIR__.'/../../views', 'flarum');
$views->addNamespace('flarum', __DIR__.'/../../views');
$views->share([
'translator' => $container->make('translator'),

View File

@ -13,6 +13,7 @@ use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\View\Factory as ViewFactory;
class InstallServiceProvider extends AbstractServiceProvider
{
@ -29,9 +30,9 @@ class InstallServiceProvider extends AbstractServiceProvider
/**
* {@inheritdoc}
*/
public function boot(Container $container, RouteHandlerFactory $route)
public function boot(Container $container, RouteHandlerFactory $route, ViewFactory $views)
{
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
$views->addNamespace('flarum.install', __DIR__.'/../../views/install');
$this->populateRoutes($container->make('flarum.install.routes'), $route);
}

View File

@ -13,6 +13,7 @@ use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\View\Factory as ViewFactory;
class UpdateServiceProvider extends AbstractServiceProvider
{
@ -30,9 +31,9 @@ class UpdateServiceProvider extends AbstractServiceProvider
});
}
public function boot()
public function boot(ViewFactory $views)
{
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.update');
$views->addNamespace('flarum.update', __DIR__ . '/../../views/install');
}
/**