Problem/Motivation
"- Select a value -" for required field or "- None -" for unrequired field doesn't appear (becomes empty) if term is single in a level.
They appear if terms are multiple in a level.
Steps to reproduce
Create terms; (See terms.png)
Level1 "1" > Level2 "1-1", "1-2", "1-3", "1-4"
Level1 "2" > Level2 "2-1"
Show SHS on a node. (See rc4_multiterm_OK.png, rc4_singleterm_NG.png, expected_singleterm.png)
Proposed resolution
Reverting /shs/js/views/WidgetView.js of 2.0.0-rc4 to 2.0.0-rc1 works OK.
diff WidgetView.js WidgetView.js.rc1
97a98,100
> // Add "any" option.
> widget.$el.append($('').text(widget.container.app.getSetting('anyLabel')).val(widget.container.app.getSetting('anyValue')));
>
122,126d124
<
< // Add "any" option.
< if (widget.model.itemCollection.length > 1) {
< widget.$el.append($('').text(widget.container.app.getSetting('anyLabel')).val(widget.container.app.getSetting('anyValue')));
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | shs-3359292-10.patch | 872 bytes | grimreaper |
| #7 | shs-empty_value_not_appearing_3359292-compat_with_3269746-mr-4.patch | 738 bytes | rossb89 |
| #4 | shs-support-anylabel-for-single-select-value-3359292-4.patch | 469 bytes | dydave |
| expected_singleterm.png | 1.07 KB | kubokura | |
| rc4_singleterm_NG.png | 906 bytes | kubokura |
Issue fork shs-3359292
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
sunidhinegi31 commentedI am working on this issue.
Comment #3
sunidhinegi31 commentedComment #4
dydave commentedHi everyone,
Thank you very much for raising this issue and suggesting the changes needed, it's greatly appreciated.
After taking a closer look in the issue queue, it appears this particular ticket is conflicting with the work that was done previously in #3254384: anyLabel is set up even if there is only one element in the list, with the following change:
https://git.drupalcode.org/project/shs/-/commit/e0847eb9c10182ac0057f298...
As suggested in the issue summary, roling back these changes seems to fix the problem.
Please find attached to this reply a patch on '2.0.x':
shs-support-anylabel-for-single-select-value-3359292-4.patch
We would greatly appreciate if you could please try testing the patch and let us know if you encounter any issues.
Feel free to let us know if you have any questions on the patch, or this ticket in general, we would be glad to provide more information.
Thanks in advance!
Comment #5
kubokura commentedHi DYdave-san, thank you for the patch.
The patch works for me. Terms appear correctly instead of blank.
(It seems the patch conflicts with 4.diff on https://www.drupal.org/project/shs/issues/3269746 , so I have needed to edit js/views/WidgetView.js manually.)
Comment #6
grimreaperHi,
Thanks for the patch.
Applied and it fixed the problem.
Comment #7
rossb89 commentedThanks for the work here. I also had the same issue as @kubokura in that I need this patch and the MR patch from #3269746 as well really and they are both modifying the same line.
I've created a combo patch if anyone finds they need both patches really (I can't see why you wouldn't need both!) which will suffice until such time one is merged and then the other can be patched cleanly and merged :)
Comment #8
grimreaperHi,
Patch no more apply on 2.0.2.
Creating MR.
Comment #10
grimreaperMR created.
Patch from MR for Composer.
Comment #11
luongosb commentedTested and can confirm it is working correctly in our environment.
Comment #12
steven jones commentedPatch in #10 / MR!36 is working for us, thanks for the work here.
Comment #13
giannis makantasis commentedPatch in #10 for module version 2.0.2 is working for us as well , thanks!
Comment #14
luongosb commentedConfirming that patch #10 is working with version 2.0.2. Thank you!
Comment #15
joseph.olstadComment #16
joseph.olstad