FEATURE: extend registering widgets by setting template and module ID
This commit is contained in:
@@ -19,8 +19,10 @@ class WidgetRegistrator
|
|||||||
* Method used for registering new widgets
|
* Method used for registering new widgets
|
||||||
*
|
*
|
||||||
* @param $classname
|
* @param $classname
|
||||||
|
* @param null $templateId
|
||||||
|
* @param null $moduleId
|
||||||
*/
|
*/
|
||||||
public function register($classname)
|
public function register($classname, $templateId = null, $moduleId = null)
|
||||||
{
|
{
|
||||||
$class = new $classname;
|
$class = new $classname;
|
||||||
if (!$class instanceof PublicWidget) {
|
if (!$class instanceof PublicWidget) {
|
||||||
@@ -36,6 +38,8 @@ class WidgetRegistrator
|
|||||||
WidgetType::create([
|
WidgetType::create([
|
||||||
'handler' => $classname,
|
'handler' => $classname,
|
||||||
'name' => $widgetName,
|
'name' => $widgetName,
|
||||||
|
'module_id' => $moduleId,
|
||||||
|
'template_id' => $templateId,
|
||||||
'description' => $widgetDescription
|
'description' => $widgetDescription
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user