mirror of
https://github.com/flarum/core.git
synced 2025-10-13 16:05:05 +02:00
Restructure Flarum\Admin namespace
This commit is contained in:
68
src/Admin/Controller/FrontendController.php
Normal file
68
src/Admin/Controller/FrontendController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Admin\Controller;
|
||||
|
||||
use Flarum\Admin\Frontend;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Http\Controller\AbstractWebAppController;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class FrontendController extends AbstractWebAppController
|
||||
{
|
||||
/**
|
||||
* @var SettingsRepositoryInterface
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* @var ExtensionManager
|
||||
*/
|
||||
protected $extensions;
|
||||
|
||||
/**
|
||||
* @param Frontend $webApp
|
||||
* @param Dispatcher $events
|
||||
* @param SettingsRepositoryInterface $settings
|
||||
* @param ExtensionManager $extensions
|
||||
*/
|
||||
public function __construct(Frontend $webApp, Dispatcher $events, SettingsRepositoryInterface $settings, ExtensionManager $extensions)
|
||||
{
|
||||
$this->webApp = $webApp;
|
||||
$this->events = $events;
|
||||
$this->settings = $settings;
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getView(ServerRequestInterface $request)
|
||||
{
|
||||
$view = parent::getView($request);
|
||||
|
||||
$settings = $this->settings->all();
|
||||
|
||||
$this->events->fire(
|
||||
new PrepareUnserializedSettings($settings)
|
||||
);
|
||||
|
||||
$view->setVariable('settings', $settings);
|
||||
$view->setVariable('permissions', Permission::map());
|
||||
$view->setVariable('extensions', $this->extensions->getExtensions()->toArray());
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user