Calling a widget in a plugin with a custom widget template?

More
2 months 2 weeks ago #173165 by timstallmann
timstallmann created the topic: Calling a widget in a plugin with a custom widget template?
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)
 $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?

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #173166 by timstallmann
timstallmann replied the 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?

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #173206 by DenisChenu
DenisChenu replied the topic: Calling a widget in a plugin with a custom widget template?
Because pluigin are not Yii module, my way to do is
Yii::setPathOfAlias(get_class($this),dirname(__FILE__));
Yii::app()->controller->render(get_class($this).".views.myview",$renderData);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #173518 by timstallmann
timstallmann replied the topic: Calling a widget in a plugin with a custom widget template?
Nice!! Thanks!

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #173528 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!