Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Elements webform_codemirror and webform_rating require the installation of JS libraries to work properly, but this is not mentioned on admin/structure/webform/config/elements where these elements can be enabled. I suggest that the description for these elements mention that the user will need to visit admin/structure/webform/config/libraries to enable the corresponding library.
Comment | File | Size | Author |
---|---|---|---|
#13 | 3260486-11.patch | 5.4 KB | jrockowitz |
#11 | 3260486-10.patch | 3.73 KB | jrockowitz |
Issue fork webform-3260486
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedInformation about external libraries is documented via https://www.drupal.org/docs/contributed-modules/webform/webform-libraries and /admin/structure/webform/config/libraries
Comment #3
Liam MorlandHere is an example of the problem as I see it: A user enables webform_rating element type. They add one to a form and all they see is a generic slider. They would have to know to go to a different page and enable the jQuery: RateIt library to get the star ratings that are intended by this module. To solve the problem, the description on admin/structure/webform/config/elements could say "This element requires that you enable the jQuery: RateIt library."
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI thought there was code to remove elements when the dependent library is disabled.
Comment #5
Liam MorlandI just enabled webform_rating and jQuery: RateIt and then disabled the latter. The former was still enabled. (Unless it is new; the test I just did was on WF 6.1. Let me know if you want met to try it on 6.2.)
Even if that worked, that doesn't mean it works the other way around: Enabling webform_rating would need to enable jQuery: RateIt. But that shouldn't happen without warning the user.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedThe webform_rating and webform_signature elements have this problem/challenge.
In \Drupal\webform\WebformLibrariesManager::initLibraries the related elements for each library is tracked. This information would be used to append the warning to the /admin/structure/webform/config/elements page.
If the signature elements case if the library is disabled the element stops working. This is not good.
A few thoughts...
Comment #7
Liam MorlandAs I understand it, jQuery: RateIt is only used with webform_rating. Perhaps it should not appear at all on the libraries page. It should be considered part of webform_rating and turn on and off with it. There should be a notice with each element type that has such a JS dependency. webform_codemirror should probably be the same.
Webform has three ways that functionality can be turned on and off: Element types, libraries, and sub-modules. It may be confusing to have three. One solution would be to move everything into sub-modules. For example, a webform_rating sub-module would provide the element type and the JS to support it.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI think moving elements into submodule could be an okay solution but it requires a bit work and introduces the risk of regressions.
I don't have the bandwidth to do that level of refactoring or support that major of a change right now.
Comment #9
Liam MorlandYes, it is a big change. Changes to the item descriptions is an easy way to accomplish some of this.
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedComment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI update the element description to recognize which external library is being used.
Comment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedComment #14
Liam MorlandReading the patch, it looks good. Perhaps the library names should be links instead of having the URL in brackets after it.
Comment #18
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI was able to add links to annotations. I committed the patch.