From a83f19b614673061f860df4738aa313f055f0dbd Mon Sep 17 00:00:00 2001 From: Giuseppe Criscione <18699708+giuscris@users.noreply.github.com> Date: Sat, 26 Dec 2020 15:57:28 +0100 Subject: [PATCH] Remove `AdminView` class --- admin/helpers.php | 6 ++- formwork/src/Admin/AdminView.php | 47 ------------------- .../Admin/Controllers/AbstractController.php | 10 +++- 3 files changed, 13 insertions(+), 50 deletions(-) delete mode 100644 formwork/src/Admin/AdminView.php diff --git a/admin/helpers.php b/admin/helpers.php index 0b67a5fe..5d7dcbea 100644 --- a/admin/helpers.php +++ b/admin/helpers.php @@ -1,3 +1,7 @@ static function () { + return \Formwork\Formwork::instance()->admin()->assets(); + } +]; diff --git a/formwork/src/Admin/AdminView.php b/formwork/src/Admin/AdminView.php deleted file mode 100644 index 18405f34..00000000 --- a/formwork/src/Admin/AdminView.php +++ /dev/null @@ -1,47 +0,0 @@ -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(); - } -} diff --git a/formwork/src/Admin/Controllers/AbstractController.php b/formwork/src/Admin/Controllers/AbstractController.php index d5ceb808..590cec8e 100644 --- a/formwork/src/Admin/Controllers/AbstractController.php +++ b/formwork/src/Admin/Controllers/AbstractController.php @@ -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); }