View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 17494 | Bug reports | Plugins | public | 2021-08-04 13:33 | 2021-08-05 11:19 |
| Reporter | ollehar | Assigned To | JHoeck | ||
| Priority | normal | Severity | minor | ||
| Status | assigned | Resolution | open | ||
| Summary | 17494: New plugin event system to extend forms | ||||
| Description | https://www.drupal.org/docs/drupal-apis/form-api/introduction-to-form-api https://symfony.com/doc/current/form/create_form_type_extension.html https://symfony.com/doc/current/form/events.html We want to move the 2FA plugin to add a new tab to user account settings. For this we need a new event to push new form elements to the existing form, and also to save the new data at form submit. Suggestion:
Form must be listened to at two places in the code: When rendering the form HTML, and when submitting. Only one event is needed if the element object contains information and logic on how to save and validate it. JS validation will not be possible with this way. Extra JS needs to be registered for that to work. abstract class PluginFormElement // type=input // type=textarea Etc for checkbox, radio, ... | ||||
| Tags | No tags attached. | ||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | |||||
| I will donate to the project if issue is resolved | |||||
| Browser | |||||
| Database type & version | |||||
| Server OS (if known) | |||||
| Webserver software & version (if known) | |||||
| PHP Version | |||||
| Git branch / Pull Request URL | N/A | ||||
| related to | 14290 | closed | DenisChenu | Some form can not be submitted if csrfTokenName is updated |
|
Ping @Mazi, @DenisChenu, @gabrieljenik for feedback, might be relevant for everyone who wants to write plugins. |
|
Do we need to extend form? Can't we look for some other place or some screen redesign to avoid extending forms? Not fan of extending forms as that means forms are shared. |
|
|
You have any suggestions? |
|
|
See : https://gitlab.com/SondagesPro/mailing/smtpByUser : hacking with JS to add the form + hacking beforeControllerAction to save the form value … Else :
Yes : it can be great to have a "save only this plugin" data BUT : we need to show the form access in user data and show it like an user data
We need plugin from for
And in my opinion : current quick plugin for survey is not the best : have a complete form (like @gabrieljenik write) seem better. |
|
Menu with Plugins registered for "account plugin settings". |
|
|
Thanks for bringing this to our attenton, Olle. Adding @bismark... I second the idea of providing a better approach for adding your own form elements in a generic way. Thos JS hacks to add details to the interface can easily fail if minor HTML details get adjusted. So +1 for having a better structured way to deal with it. Only must-have is to support this for LS3. We are using that version for >90% of our projects and want to use it for future projects as well. If there is no LS3 support, I think it is more or less useless for most partners. |
|
Ooookey, so a non-hacky way is welcome, then. :) |
|
We don't have the man-power to support two versions. :( Already now we're really stretched thin. |
|
|
Drupal's form API: https://www.drupal.org/docs/drupal-apis/form-api/introduction-to-form-api Not easily applicable for us, since we don't represent forms as objects internally. |
|
|
Nice example from Symfony: https://symfony.com/doc/current/components/form.html#creating-a-simple-form |
|
Yes : 100000% for a better solutiin. But my client don't wait years before a working solution on a stable version. Else
Like ?r=admin/pluginhelper&sa=sidebody&plugin=myPlugin&method=actionSettings&surveyId=476427 but ?r=admin/pluginhelper&sa=sidebody&plugin=myPlugin&method=actionSettings&userid=2 ?
Maybe need
|
|
|
Example implementation to review: // Extended by all custom plugin forms. // Plugin code // LS core code to render form // Add to plugin manager (or should be separate function? Does not use "this") // LS core code to save form data
} // LS core view file |
|
|
For me : the important pmart before code and how to add it : it's
|
|
Not sure how to fix this? If you have big plugin, it's better to add separate pages, not extend existing forms.
As before, we must make sure to keep compatibility inside major version. That's why it's important that you leave feedback as soon as possible, too.
See my example above, or here (not 100% correct, draft): // Plugin code |
|
|
About the easy to add : it's tertiary ;) I made an error on a previous message.
Else for 2FA : it's My account, not User object ? right ? |
|
Yes, the account settings page.
We can't add a tab for plugin settings on every form. "Plugin settings" is not very user friendly either, as it doesn't tell the user what the tab is specifically about.
Other feature? Not sure what you mean here. |
|
|
@ollehar, I totally understand that it is complicated to add this at two versions and that this requires some additional ressources. But if this will not be developed for LS3, then just forget about it and use the ressources for something else. We are using LS 3 for > 90% of our projects and my experience is that >80% of all users are using LS3, maybe 5-10% use LS 2.x and only the minor rest is using a newer version. Of course, that will change, but that will take years. |
|
See https://gitlab.com/SondagesPro/TokenManagement/TokenUsersListAndManage system for settings. We are inside survey. It great if we can have same page with : inside User, inside SurveyGrouo, inside QuestionGroup, inside Question About @Mazi message : i'm between the 2 position .
|
|
|
@Mazi, the issue is not adding the feature in two version, the problem is maintaining them in two versions. :) Bug fixes, added functionality, divergence in HTML or elsewhere, etc. We really want to move LS3 to "security fixes only" and focus entirely on LS5, for the sanity of the team. Anyway, this feature has been postponed since we found another quicker fix that works for us. Maybe we can outsource its implementation later, since it's something that's needed and wanted. :) |
|
Unit tests... It's the only way. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2021-08-04 13:33 | ollehar | New Issue | |
| 2021-08-04 13:43 | ollehar | Priority | none => normal |
| 2021-08-04 13:43 | ollehar | Description Updated | |
| 2021-08-04 13:43 | ollehar | Sync to Zoho Project | Yes => |Yes| |
| 2021-08-04 13:43 | LimeBot | Zoho Projects ID | => 85781000001116001 |
| 2021-08-04 13:44 | ollehar | Note Added: 65805 | |
| 2021-08-04 13:45 | ollehar | Description Updated | |
| 2021-08-04 13:45 | ollehar | Sync to Zoho Project | Yes => |Yes| |
| 2021-08-04 14:10 | gabrieljenik | Note Added: 65806 | |
| 2021-08-04 14:11 | ollehar | Note Added: 65807 | |
| 2021-08-04 14:36 | DenisChenu | Note Added: 65809 | |
| 2021-08-04 14:36 | DenisChenu | File Added: Capture d’écran du 2021-08-04 14-28-08.png | |
| 2021-08-04 14:36 | DenisChenu | File Added: Capture d’écran du 2021-08-04 14-34-48.png | |
| 2021-08-04 14:39 | DenisChenu | Relationship added | related to 14290 |
| 2021-08-04 14:45 | gabrieljenik | Note Added: 65812 | |
| 2021-08-04 15:03 | Mazi | Note Added: 65817 | |
| 2021-08-04 15:06 | ollehar | Assigned To | => JHoeck |
| 2021-08-04 15:06 | ollehar | Status | new => assigned |
| 2021-08-04 15:07 | ollehar | Note Added: 65819 | |
| 2021-08-04 15:08 | ollehar | Note Added: 65820 | |
| 2021-08-04 15:10 | ollehar | Note Edited: 65820 | |
| 2021-08-04 16:01 | ollehar | Note Added: 65836 | |
| 2021-08-04 16:01 | ollehar | Description Updated | |
| 2021-08-04 16:01 | ollehar | Sync to Zoho Project | Yes => |Yes| |
| 2021-08-04 16:02 | ollehar | Note Edited: 65836 | |
| 2021-08-04 16:08 | ollehar | Description Updated | |
| 2021-08-04 16:08 | ollehar | Sync to Zoho Project | Yes => |Yes| |
| 2021-08-04 16:27 | ollehar | Note Added: 65837 | |
| 2021-08-04 16:29 | ollehar | Description Updated | |
| 2021-08-04 16:29 | ollehar | Sync to Zoho Project | Yes => |Yes| |
| 2021-08-04 16:49 | DenisChenu | Note Added: 65838 | |
| 2021-08-04 16:55 | ollehar | Note Added: 65840 | |
| 2021-08-04 16:58 | DenisChenu | Note Added: 65841 | |
| 2021-08-04 16:58 | ollehar | Note Edited: 65840 | |
| 2021-08-04 17:00 | ollehar | Note Edited: 65840 | |
| 2021-08-04 17:01 | ollehar | Note Edited: 65840 | |
| 2021-08-04 17:03 | ollehar | Note Edited: 65840 | |
| 2021-08-04 17:05 | ollehar | Note Added: 65842 | |
| 2021-08-04 17:11 | ollehar | Note Edited: 65840 | |
| 2021-08-04 18:23 | DenisChenu | Note Added: 65843 | |
| 2021-08-04 20:45 | ollehar | Note Added: 65845 | |
| 2021-08-05 08:30 | Mazi | Note Added: 65847 | |
| 2021-08-05 10:36 | DenisChenu | Note Added: 65848 | |
| 2021-08-05 10:36 | DenisChenu | File Added: Capture d’écran du 2021-08-05 10-32-28.png | |
| 2021-08-05 11:18 | ollehar | Note Added: 65849 | |
| 2021-08-05 11:19 | ollehar | Note Added: 65850 |