- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Calling a widget in a plugin with a custom widget template?
- timstallmann
- Topic Author
- Offline
- New Member
Less
More
5 years 7 months ago #173165
by timstallmann
Calling a widget in a plugin with a custom widget template? was created by timstallmann
Hi! I'm trying to build a plugin that creates a custom, simplified view of survey results on the admin side. I've managed to follow the tutorials and get the menu items created, and am trying to create a new TbListView widget to render the list of results, using code like this (inside my view template file)
The problem I'm running into is when this code runs, the AdminController->getViewFile method gets called, and it's looking in /var/www/html/application/views for my view template file, which should be in plugins/modulename/views instead. Any idea how to resolve this? Do I need to create a custom controller for the plugin?
Code:
$this->widget('bootstrap.widgets.TbListView', array( 'dataProvider' => $model->search(), 'itemView' => 'support_request', 'sortableAttributes' => array( 'datestamp', 'FactoryName', 'City', ), ));
The problem I'm running into is when this code runs, the AdminController->getViewFile method gets called, and it's looking in /var/www/html/application/views for my view template file, which should be in plugins/modulename/views instead. Any idea how to resolve this? Do I need to create a custom controller for the plugin?
The topic has been locked.
- timstallmann
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 years 7 months ago #173166
by timstallmann
Replied by timstallmann on topic Calling a widget in a plugin with a custom widget template?
Ok classic example of rubber-ducking a problem here, immediately after posting I realized that changing the itemView attribute to plugin_views_folder2.views.support_request solves the problem. But why?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 7 months ago #173206
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Calling a widget in a plugin with a custom widget template?
Because pluigin are not Yii module, my way to do is
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- timstallmann
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 years 7 months ago #173518
by timstallmann
Replied by timstallmann on topic Calling a widget in a plugin with a custom widget template?
Nice!! Thanks!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 7 months ago #173528
by DenisChenu
I don't know where you want to use it ? If it's out of public page : some insipration :
- gitlab.com/SondagesPro/managament/respon...tAndManage.php#L1473
- gitlab.com/SondagesPro/coreAndTools/renderMessage
To show a dynamic list even with twig : you need to do it out of twig i think. gitlab.com/SondagesPro/managament/respon.../content/surveys.php
Maybe we can add function to call widget in twig manager : github.com/LimeSurvey/LimeSurvey/blob/ma...S_Twig_Extension.php
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Calling a widget in a plugin with a custom widget template?
I don't know where you want to use it ? If it's out of public page : some insipration :
- gitlab.com/SondagesPro/managament/respon...tAndManage.php#L1473
- gitlab.com/SondagesPro/coreAndTools/renderMessage
To show a dynamic list even with twig : you need to do it out of twig i think. gitlab.com/SondagesPro/managament/respon.../content/surveys.php
Maybe we can add function to call widget in twig manager : github.com/LimeSurvey/LimeSurvey/blob/ma...S_Twig_Extension.php
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.