mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 21:49:04 +01:00
Remove AdminView
class
This commit is contained in:
parent
e3a8f4b00e
commit
a83f19b614
@ -1,3 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [];
|
||||
return [
|
||||
'assets' => static function () {
|
||||
return \Formwork\Formwork::instance()->admin()->assets();
|
||||
}
|
||||
];
|
||||
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Formwork\Admin;
|
||||
|
||||
use Formwork\Assets;
|
||||
use Formwork\Formwork;
|
||||
use Formwork\Parsers\PHP;
|
||||
use Formwork\View\View;
|
||||
|
||||
class AdminView extends View
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected const TYPE = 'admin view';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected static $helpers = [];
|
||||
|
||||
/**
|
||||
* View assets instance
|
||||
*
|
||||
* @var Assets
|
||||
*/
|
||||
protected $assets;
|
||||
|
||||
/**
|
||||
* Get Assets instance
|
||||
*/
|
||||
public function assets(): Assets
|
||||
{
|
||||
if ($this->assets !== null) {
|
||||
return $this->assets;
|
||||
}
|
||||
return $this->assets = new Assets(ADMIN_PATH . 'assets' . DS, Formwork::instance()->admin()->realUri('/assets/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function helpers(): array
|
||||
{
|
||||
return PHP::parseFile(ADMIN_PATH . 'helpers.php') + parent::helpers();
|
||||
}
|
||||
}
|
@ -3,14 +3,15 @@
|
||||
namespace Formwork\Admin\Controllers;
|
||||
|
||||
use Formwork\Admin\Admin;
|
||||
use Formwork\Admin\AdminView;
|
||||
use Formwork\Admin\Security\CSRFToken;
|
||||
use Formwork\Admin\Users\User;
|
||||
use Formwork\Formwork;
|
||||
use Formwork\Parsers\JSON;
|
||||
use Formwork\Parsers\PHP;
|
||||
use Formwork\Site;
|
||||
use Formwork\Utils\Date;
|
||||
use Formwork\Utils\Str;
|
||||
use Formwork\View\View;
|
||||
|
||||
abstract class AbstractController
|
||||
{
|
||||
@ -132,7 +133,12 @@ abstract class AbstractController
|
||||
*/
|
||||
protected function view(string $name, array $data = [], bool $return = false)
|
||||
{
|
||||
$view = new AdminView($name, array_merge($this->defaults(), $data), Formwork::instance()->config()->get('views.paths.admin'));
|
||||
$view = new View(
|
||||
$name,
|
||||
array_merge($this->defaults(), $data),
|
||||
Formwork::instance()->config()->get('views.paths.admin'),
|
||||
PHP::parseFile(ADMIN_PATH . 'helpers.php')
|
||||
);
|
||||
return $view->render($return);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user