Welcome to the LimeSurvey Community Forum

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

event "beforeQuestionRender"

  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #164310 by orvil
event "beforeQuestionRender" was created by orvil
Hi,
I found this example for a plugin

<?php
class HelloWorld extends \ls\pluginmanager\PluginBase{

static protected $description = 'Hello World Plugin';
static protected $name = 'Hello World';


public function init() {
$this->subscribe('beforeQuestionRender');
}

public function beforeQuestionRender(){
$this->getEvent()->set('questionhelp', 'Hello World');
}

}
?>

Plugin can be seen and activated in plugin manager, but the render part does not work in 3.3.1- although the call seems to fit the description in the manual. Any suggestions? Are there different event names /calls now?

Thanks

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 10 months ago #164316 by DenisChenu
Replied by DenisChenu on topic event "beforeQuestionRender"
I think it must work , but surely a bug to be reported

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #164320 by orvil
Replied by orvil on topic event "beforeQuestionRender"
Unfortunately it does not. Tried different approaches, but in vain.

Background: I'm trying to reproduce the addScript to question plugin for 3.3.1 because the current version, avaliable at the plugin section does not work anymore. Everything is fine except the js-code 'injection'. Thanks in advance for any suggestions on this case.

Thanks

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 10 months ago #164324 by DenisChenu
Replied by DenisChenu on topic event "beforeQuestionRender"
This one : www.limesurvey.org/index.php?option=com_...oquestion&Itemid=729 ?

It use Yii registerScript system, then it's something else.

I didn't start working on fix it for 3.X version on any plugin … i think i start by sendMailCron

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #164332 by orvil
Replied by orvil on topic event "beforeQuestionRender"
Yes, this one :)
Think this is a good training for me to learn. I do have some ideas for plugins that may be of interest for all users, but it's a long road from an idea to a working plugin :ohmy:

Especially the inserting / replacement / prepending / appaneding to the html and/or js-source of questions and the admin interface is of essence. So I still hope there is someone with some suggestions...

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 10 months ago - 6 years 10 months ago #164335 by DenisChenu
Replied by DenisChenu on topic event "beforeQuestionRender"

orvil wrote: So I still hope there is someone with some suggestions...

My suggestion : your HelloWorld plugin must work if you fix the extend
Code:
class HelloWorld extends PluginBase{}

If questionhelp are not updated : Report the bug

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 6 years 10 months ago by DenisChenu.
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #164343 by orvil
Replied by orvil on topic event "beforeQuestionRender"
Unfortunately this is NOT the crucial point, I'm using this meanwhile.

The Plugin is shown in the Configuration > Plugin Manager section of the admin interface correctly. So it is registered and active. The part of my reproduction of the addScriptToQuestion where some properties are shown in the questions option are working too - see the attached image.

Only the call(s) for rendering as given in the first example does not work. That's a pitty :(

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 10 months ago #164471 by DenisChenu
Replied by DenisChenu on topic event "beforeQuestionRender"

orvil wrote: …
Only the call(s) for rendering as given in the first example does not work. That's a pitty :(

Did you report the bug ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago #164513 by orvil
Replied by orvil on topic event "beforeQuestionRender"
Not yet. Do you think it's not my fault? Maybe I forgot something. If not I'll report it.

P.S.: there is no example in the manual www.limesurvey.org/manual/BeforeQuestionRender
Could make things more easy

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago #164517 by orvil
Replied by orvil on topic event "beforeQuestionRender"
meanwhile I found via $this->log() that
- function beforeQuestionRender() is never called when displaying a question

but
- function init() is called for each question. I'm surprised about that, thought init() is only called once

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 9 months ago #164528 by DenisChenu
Replied by DenisChenu on topic event "beforeQuestionRender"

DenisChenu wrote: I think it must work , but surely a bug to be reported


PS : if you want to know if it's ytour fault : test you plugin in a 2.7X version
PS2: you'r right : init must happen only one time, like afterLoad plugin

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: orvil
The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago #164530 by orvil
Replied by orvil on topic event "beforeQuestionRender"
Thanks, I will do so.

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose