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

Mehr
2 Monate 2 Wochen her #173165 von timstallmann
timstallmann erstellte das Thema 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?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 2 Wochen her #173166 von timstallmann
timstallmann antwortete auf das Thema: 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?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 2 Wochen her #173206 von DenisChenu
DenisChenu antwortete auf das Thema: 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 .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 1 Woche her #173518 von timstallmann
timstallmann antwortete auf das Thema: Calling a widget in a plugin with a custom widget template?
Nice!! Thanks!

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 1 Woche her #173528 von DenisChenu
DenisChenu antwortete auf das Thema: 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 .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha