View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
11704 | Bug reports | Plugins | public | 2016-09-23 04:38 | 2020-03-13 18:46 |
Reporter | YuriyBabenko | Assigned To | ollehar | ||
Priority | none | Severity | minor | ||
Status | closed | Resolution | open | ||
Product Version | 2.52.x | ||||
Summary | 11704: No implementation of beforeSurveyBarRender event | ||||
Description | The plugin events page (https://manual.limesurvey.org/Plugin_events) lists the 'beforeSurveyBarRender' event. On my copy of 2.52, there are no references to this string anywhere in the codebase, and my plugin's implementation of this event does not get called. | ||||
Steps To Reproduce | grep -ri "beforeSurveyBarRender" *; | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 20160922 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | 260 | ||||
Server OS (if known) | OSX | ||||
Webserver software & version (if known) | Apache 2.x | ||||
PHP Version | 5.6.x | ||||
Else : Thanks for the update of the manual :) There are some event i didn't know and don't found a good way to use it :) What doi you think of purpose of beforeSurveyBarRender ? @olle : i assign this to you. It's not a plugin event inside another plugin ? Think it's when you work on "Menu" |
|
@DenisChenu - I've attached an image of what I believe to be the Survey Bar Menu. My original intent was looking for a way to add items to this menu. Ideally, I would like my plugin to have full control over the items in this menu (and other menus, but that's another topic). The Survey Bar Menu's structure is built in the _surveybar() method in Survey_Common_Action.php. I believe the event should be triggered from that method. What I would like to see is that method creating a default set of menu links, and then passing that data to the event - thereby allowing plugins to change/add the menu links - and then expose the data to the surveybar_view.php file that would subsequently loop through the menu items and render them. If this issue is still unresolved by tomorrow and there are no objections, I'll build out the above functionality and issue a Pull Request on GitHub. Cheers. |
|
Hi YuriyBabenko : you'r totally right : we must have a way to extend all menu. BUT : i don't think we need an event for each menu ;)
Actually : i think this 2 event : I'm unsure for this We are always happy to have pull request and discussion to improve LS core :) |
|
@DenisChenu - a single event for all menus is fine too, but only if the same data structure is expected for all menu types. Currently, beforeAdminMenuRender() must set 'extraMenus' to an array of \ls\menu\Menu items, but beforeToolsMenuRender() must set 'menuItems' to an array of \ls\menu\MenuItem items. This disconnect would cause problems if we were to use a single event handler for all admin menus. I think some refactoring and standardization is needed here. |
|
" I think some refactoring and standardization is needed here. " |
|
Hi Yuriy, First of all: What's your use-case? Second: Yes, beforeAdminMenuRender() and beforeToolsMenuRender() accept different objects, but that is because the first renders a new menu entry, the second just adds menu items to an existent menu entry. That's why beforeToolsMenuRender() accepts menuItem objects. |
|
@olle : question :
If no : do you think it can be done to update this 2 event to add "what menu wrapper (some menu-wrapper id) + object name + object id for example :'menu'=>'participantbar','object'=>'participant','objectid'=>(isset($participantid)?$participantid:null, Somethink like this ? After we can remove all extra menu/bar events |
|
@olle - My use case is adding a new link to the survey bar. This link will show a modal that will allow re-using existing questions/answers from previous surveys in the current survey. All that will be handled in the plugin and I've PoC'd it, but adding the link is where I got stuck yesterday. |
|
I just created a PR with a basic implementation of the missing event: https://github.com/LimeSurvey/LimeSurvey/pull/537 |
|
That's nice, but as I said in the comment section on GitHub, I already implemented this feature in the cint branch some weeks ago. Could you please have a look at that and see if it fits all your requirements? |
|
@olle - no, the code on the 'cint' branch does not work for our needs. Two problems:
We can sorta-kinda get around this by checking the URI of the current page and making assumptions, but that's an ugly solution.
|
|
Thanks for your feedback. About 1, how about adding two additional inputs to the event: controller name and action name? You can then use that to decide when to add additional buttons.
|
|
For "controller name and action name" : yes , must be. object and object id too ? ;) |
|
Denis, id of which object? Yuriy, about 2, what about moving the rendering to just before "right action buttons"? |
|
@olle - Controller and Action names would be nice. I'm guessing @DenisChenu was referring to the model object (Survey, in this case) and its ID. Also, there's a bug with the logic in surveybar_view.php: There's a check for if ($menu->isDropDown()), and in the else condition, a call to $menu->getIconClass(). The Menu class does not have a getIconClass() method. |
|
Also - moving the view logic to just before "right action buttons" gets around the problem of being nested under a false condition, but this results in the buttons being printed out in a new DIV, bumping them down to a new line. I can get around this with CSS (floating the two containers), but that's not ideal. |
|
@Yuriy, are you working on this still? |
|
This version of LimeSurvey is not longer supported. Please check so that the issue is fixed in a more recent version of LimeSurvey. If it's not, please reopen this bug report. Thank you. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-23 04:38 | YuriyBabenko | New Issue | |
2016-09-23 08:51 | DenisChenu | Note Added: 40925 | |
2016-09-23 08:51 | DenisChenu | Assigned To | => ollehar |
2016-09-23 08:51 | DenisChenu | Status | new => assigned |
2016-09-23 09:08 | YuriyBabenko | File Added: survey bar menu.png | |
2016-09-23 09:11 | YuriyBabenko | Note Added: 40926 | |
2016-09-23 09:32 | DenisChenu | Note Added: 40927 | |
2016-09-23 09:32 | DenisChenu | Note Edited: 40927 | |
2016-09-23 09:36 | YuriyBabenko | Note Added: 40928 | |
2016-09-23 09:44 | DenisChenu | Note Added: 40929 | |
2016-09-23 10:20 | ollehar | Note Added: 40930 | |
2016-09-23 11:53 | DenisChenu | Note Added: 40933 | |
2016-09-23 11:53 | DenisChenu | Note Edited: 40933 | |
2016-09-23 19:10 | YuriyBabenko | Note Added: 40934 | |
2016-09-24 02:20 | YuriyBabenko | Note Added: 40935 | |
2016-09-26 10:27 | ollehar | Note Added: 40952 | |
2016-09-27 05:25 | YuriyBabenko | Note Added: 40963 | |
2016-09-27 10:11 | ollehar | Note Added: 40969 | |
2016-09-27 10:15 | DenisChenu | Note Added: 40970 | |
2016-09-27 10:15 | DenisChenu | Note Edited: 40970 | |
2016-09-27 10:22 | ollehar | Note Added: 40971 | |
2016-09-27 22:07 | YuriyBabenko | Note Added: 40988 | |
2016-09-27 22:11 | YuriyBabenko | Note Added: 40989 | |
2016-10-20 15:16 | ollehar | Note Added: 41507 | |
2016-10-20 15:16 | ollehar | Status | assigned => feedback |
2020-03-13 18:46 | c_schmitz | Note Added: 56456 | |
2020-03-13 18:46 | c_schmitz | Status | feedback => closed |