mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 15:05:54 +00:00
FIX Use ModuleLoader for requirement resolution and typo in exception in Widget::getController
This commit is contained in:
parent
7c85b1b5d9
commit
9b12b602f5
@ -40,8 +40,9 @@ class WidgetAreaEditor extends FormField
|
|||||||
*/
|
*/
|
||||||
public function FieldHolder($properties = array())
|
public function FieldHolder($properties = array())
|
||||||
{
|
{
|
||||||
Requirements::css('widgets/css/WidgetAreaEditor.css');
|
$module = ModuleLoader::getModule('silverstripe/widgets');
|
||||||
Requirements::javascript('widgets/javascript/WidgetAreaEditor.js');
|
Requirements::css($module->getRelativeResourcePath('css/WidgetAreaEditor.css'));
|
||||||
|
Requirements::javascript($module->getRelativeResourcePath('javascript/WidgetAreaEditor.js'));
|
||||||
|
|
||||||
return $this->renderWith(WidgetAreaEditor::class);
|
return $this->renderWith(WidgetAreaEditor::class);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ class Widget extends DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception If the widget controller's class name couldn't be found
|
||||||
*
|
*
|
||||||
* @return WidgetController
|
* @return WidgetController
|
||||||
*/
|
*/
|
||||||
@ -268,7 +268,7 @@ class Widget extends DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists($controllerClass)) {
|
if (!class_exists($controllerClass)) {
|
||||||
throw new Exception("Could not find controller class for get_class($this)name");
|
throw new Exception('Could not find controller class for ' . $controllerClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->controller = Injector::inst()->create($controllerClass, $this);
|
$this->controller = Injector::inst()->create($controllerClass, $this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user