Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Plugin broken after upgrade to LS 3.x

  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 7 months ago - 4 years 7 months 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
Code:
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: 4 years 7 months ago by lintu.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago - 4 years 7 months ago #187273 by DenisChenu
Replied by DenisChenu on topic Plugin broken after upgrade to LS 3.x
2.5X and 3.X compatible:
Code:
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 .
I don't answer to private message.
Last edit: 4 years 7 months ago by DenisChenu.
The following user(s) said Thank You: lintu
The topic has been locked.
  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 7 months ago - 4 years 7 months ago #187276 by lintu
Replied by lintu on topic Plugin broken after upgrade to LS 3.x
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:

Code:
        $href = Yii::app()->createUrl(
            'admin/pluginhelper',
            array(
                'sa' => 'fullpagewrapper',
                'plugin' => 'myPlugin',
                'method' => 'actionIndex',
                'surveyId' => $surveyId
            )
        );
Last edit: 4 years 7 months ago by lintu.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #187279 by DenisChenu
Replied by DenisChenu on topic Plugin broken after upgrade to LS 3.x
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 .
I don't answer to private message.
The topic has been locked.
  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 7 months ago #187280 by lintu
Replied by lintu on topic Plugin broken after upgrade to LS 3.x
Thanks, was able to figure out the new URL format.
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
4 years 7 months ago #187286 by ollehar
Replied by ollehar on topic Plugin broken after upgrade to LS 3.x
"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
The topic has been locked.
  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 7 months ago #187295 by lintu
Replied by lintu on topic Plugin broken after upgrade to LS 3.x
Hi ollehar,

Thanks for the clarification. Yes, I am using the views within the plugin independent of a survey.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose