Plugin broken after upgrade to LS 3.x

More
6 months 2 weeks ago - 6 months 2 weeks ago #187268 by lintu
Hello folks,


I searched through the forum posts but was not able to find an answer to my issue. I am upgrading from LS 2.x to LS 3.x and my self-developed plugin is broken.

I have changed class myPlugin extends \ls\pluginmanager\PluginBase to class myPlugin extends \ls\pluginmanager\PluginBase

But I am getting the following error:

Class 'ls\menu\MenuItem' not found
100         $menuItem = new MenuItem(array(
101             'label' => gT('myPlugin'),
102             'iconClass' => 'fa fa-table',
103             'href' => $href
104         ));

Can someone help me with some pointer on how to resolve this issue? Thanks in advance
Last edit: 6 months 2 weeks ago by lintu.

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

LimeSurvey Partners
More
6 months 2 weeks ago - 6 months 2 weeks ago #187273 by DenisChenu
2.5X and 3.X compatible:
if (class_exists("\LimeSurvey\Menu\MenuItem")) {
            $menuItem = new \LimeSurvey\Menu\MenuItem($aMenuItem);
        } else {
            $menuItem = new \ls\menu\MenuItem($aMenuItem);
        }

gitlab.com/SondagesPro/mailing/sendMailC...ndMailCron.php#L1171

And you can extend PluginBase : it's the same shortcut for 2.X and 3.X

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 .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 6 months 2 weeks ago by DenisChenu.
The following user(s) said Thank You: lintu

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

More
6 months 2 weeks ago - 6 months 2 weeks ago #187276 by lintu
Hi DenisChenu,

Thanks a lot for your response. Another problem with version 3.x is the url generated is different. I have a php file under plugins/myPlugin/views/, what would the url be for this? Here is the code snippet:

        $href = Yii::app()->createUrl(
            'admin/pluginhelper',
            array(
                'sa' => 'fullpagewrapper',
                'plugin' => 'myPlugin',
                'method' => 'actionIndex',
                'surveyId' => $surveyId
            )
        );
Last edit: 6 months 2 weeks ago by lintu.

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

More
6 months 2 weeks ago #187279 by DenisChenu
gitlab.com/SondagesPro/mailing/sendMailC...lCron.php#L1158-1170

No ?

I don't remind using 'sa' => 'fullpagewrapper',

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 .
An error happen ? Before make a new topic : remind the Debug mode .

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

More
6 months 2 weeks ago #187280 by lintu
Thanks, was able to figure out the new URL format.

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

More
6 months 2 weeks ago #187286 by ollehar
"fullpagewrapper" is used if you want to display a full page independent of a survey. "sidebody" is used when already in survey view.
The following user(s) said Thank You: DenisChenu, lintu

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

More
6 months 2 weeks ago #187295 by lintu
Hi ollehar,

Thanks for the clarification. Yes, I am using the views within the plugin independent of a survey.

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!