From f4487076b7bfea1281b285def07d2c246bb0fcb4 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Mon, 5 Jan 2015 13:12:48 +1100 Subject: [PATCH] Remove some legacy code, no need to pipe WidgetMaker thru WidgetManager --- modules/backend/classes/WidgetManager.php | 30 ----------------------- modules/backend/traits/WidgetMaker.php | 15 ++++++++---- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/modules/backend/classes/WidgetManager.php b/modules/backend/classes/WidgetManager.php index b46cc3623..399c6df7e 100644 --- a/modules/backend/classes/WidgetManager.php +++ b/modules/backend/classes/WidgetManager.php @@ -2,12 +2,10 @@ use Str; use File; -use Lang; use Closure; use October\Rain\Support\Yaml; use Illuminate\Container\Container; use System\Classes\PluginManager; -use System\Classes\SystemException; /** * Widget manager @@ -57,34 +55,6 @@ class WidgetManager $this->pluginManager = PluginManager::instance(); } - /** - * Makes a widget object with configuration set. - * @param string $className A widget class name. - * @param Controller $controller The Backend controller that spawned this widget. - * @param array $configuration Configuration values. - * @return WidgetBase The widget object. - */ - public function makeWidget($className, $controller = null, $configuration = null) - { - /* - * Build configuration - */ - if ($configuration === null) { - $configuration = []; - } - - /* - * Create widget object - */ - if (!class_exists($className)) { - throw new SystemException(Lang::get('backend::lang.widget.not_registered', [ - 'name' => $className - ])); - } - - return new $className($controller, $configuration); - } - // // Form Widgets // diff --git a/modules/backend/traits/WidgetMaker.php b/modules/backend/traits/WidgetMaker.php index d67540746..d27fb745a 100644 --- a/modules/backend/traits/WidgetMaker.php +++ b/modules/backend/traits/WidgetMaker.php @@ -1,5 +1,6 @@ controller) ?: $this; - $manager = WidgetManager::instance(); - $widget = $manager->makeWidget($class, $controller, $configuration); - return $widget; + if (!class_exists($class)) { + throw new SystemException(Lang::get('backend::lang.widget.not_registered', [ + 'name' => $class + ])); + } + + return new $class($controller, $configuration); } }