We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

In skeleton plugin: fail adding a new widget | Forum

fiamma
fiamma Jun 28 '16
Hi all,


 At first, i installed the skeleton plugin, then i added my custom plugin (e.g. the custom html  widget renamed) and added the following code:

----


 $widget = BOL_ComponentAdminService::getInstance()->addWidget('MY_CMP_CustomHtmlWidget', false);
$placeWidget = BOL_ComponentAdminService::getInstance()->addWidgetToPlace($widget, $data['place']);BOL_ComponentAdminService::getInstance()->addWidgetToPosition($placeWidget, $data['section'], 0 )


in "index" method of SKELETON_CTRL_Widgets class.
But the following error code appears:-----Class MY_CMP_CustomHtmlWidget does not exist File: /var/www/ow_system_plugins/base/components/drag_and_drop_item.php Line: 208 Trace: #0 /var/www/ow_system_plugins/base/components/drag_and_drop_item.php(208): ReflectionClass->__construct('SPOD_CMP_Custom...') #1 /var/www/ow_system_plugins/base/components/drag_and_drop_item.php(92): BASE_CMP_DragAndDropItem->checkComponent('SPOD_CMP_Custom...') #2 /var/www/ow_system_plugins/base/components/drag_and_drop_frontend_panel.php(106): BASE_CMP_DragAndDropItem->setContentComponentClass('SPOD_CMP_Custom...') #3 /var/www/ow_smarty/template_c/0e342cba6e412c11d21e796009bbe19877a1f84f_0.file.drag_and_drop_index.html.php(152): BASE_CMP_DragAndDropFrontendPanel->tplComponent(Array, Object(Smarty_Internal_Template)) #4 /var/www/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(122): content_576ebe69639ec0_37578225(Object(Smarty_Internal_Template)) #5 /var/www/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(199): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #6 /var/www/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(159): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template)) #7 /var/www/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(191): Smarty_Internal_Template->render(false, 0) #8 /var/www/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(94): Smarty_Internal_TemplateBase->_execute('/var/www/ow_sys...', NULL, NULL, NULL, 0) #9 /var/www/ow_core/view_renderer.php(101): Smarty_Internal_TemplateBase->fetch('/var/www/ow_sys...') #10 /var/www/ow_core/renderable.php(271): OW_ViewRenderer->renderTemplate('/var/www/ow_sys...') #11 /var/www/ow_core/component.php(80): OW_Renderable->render() #12 /var/www/ow_core/renderable.php(258): OW_Component->render() #13 /var/www/ow_system_plugins/base/controllers/component_panel.php(56): OW_Renderable->render() #14 /var/www/ow_core/request_handler.php(274): BASE_CTRL_ComponentPanel->render() #15 /var/www/ow_core/application.php(376): OW_RequestHandler->dispatch() #16 /var/www/index.php(76): OW_Application->handleRequest() #17 {main}




----



Please, any suggestion for my issue,Thanks in advance.

The Forum post is edited by fiamma Jun 28 '16
dave Leader
dave Jun 28 '16
did you deactivate and reactivate the plugin, that code goes in the activate folder so it will not execute until you activate the plugin.. 
ross Team
ross Jun 28 '16
Topic was moved from General Questions.
fiamma
fiamma Jun 29 '16
Hi Dave,


the activate.php file  contains the following code:

----

$widget = BOL_ComponentAdminService::getInstance()->addWidget('MY_CMP_CustomHtmlWidget');$placeWidget = BOL_ComponentAdminService::getInstance()->addWidgetToPlace($widget, BOL_ComponentAdminService::PLACE_PROFILE);BOL_ComponentAdminService::getInstance()->addWidgetToPosition($placeWidget, BOL_ComponentAdminService::SECTION_LEFT);


--

and deactive.php file contains :

BOL_ComponentAdminService::getInstance()->deleteWidget('MY_CMP_CustomHtmlWidget');

---

but the exception is teh same (Type ReflectionException):

Class MY_CMP_CustomHtmlWidget does not exist File:/var/www/ow_system_plugins/base/components/drag_and_drop_item.phpLine:208Trace:#0 /var/www/ow_system_plugins/base/components/drag_and_drop_item.php(208): ReflectionClass->__construct('MY_CMP_Custom...') #1 /var/www/ow_system_plugins/base/components/drag_and_drop_item.php(92): BASE_CMP_DragAndDropItem->checkComponent('MY_CMP_Custom...') #2 /var/www/ow_system_plugins/base/components/drag_and_drop_frontend_panel.php(106): BASE_CMP_DragAndDropItem->setContentComponentClass('MY_CMP_Custom...') #3 /var/www/ow_smarty/template_c/0e342cba6e412c11d21e796009bbe19877a1f84f_0.file.drag_and_drop_index.html.php(120): BASE_CMP_DragAndDropFrontendPanel->tplCom

...

have you any suggestion?

thanks!


The Forum post is edited by fiamma Jun 29 '16