Problem/Motivation
I needed this addon to save the term lineage to this great module,
My website has country-region-place content, and this patch was needed to save this to the database, and be able to use the lineage on Drupal 10. My website was before drupal 7, and there I used Hierarchical Select, but that module is not alive anymore on Drupal 10. Great SHS is there!
So I let a great company Drudesk from Ukrain, please support Ukrain! https://www.drupal.org/drudesk, to alter the patch from https://www.drupal.org/project/shs/issues/2943357 to work with drupal 10!
Hereby the patch. I add underneath how my composer.json file looks like to be able to alter SHS as such that with it I am able to add new terms, and save the lineage of the terms.
Please commit the patch to SHS 2.0-dev! Thanks in advance!
| Comment | File | Size | Author |
|---|---|---|---|
| #44 | save-term-lineage-2943357-44.patch | 17.95 KB | s3b0un3t |
| #43 | empty code new term.jpg | 16.22 KB | summit |
| #43 | filled in new place.jpg | 58.59 KB | summit |
| #43 | fill-in-new place.jpg | 38.71 KB | summit |
| #15 | 2024-03-25_10-30.png | 8.88 KB | heddn |
Comments
Comment #2
summit commentedComment #3
summit commentedComment #4
summit commentedUsing also above patch, my composer.json file for SHS looks like this:
With SHS and this code I can add new terms, and we can save the term lineage with these terms on node/edit pages.
Greetings,
Comment #5
summit commentedHi, This is tested and ready. Greetings,
Comment #6
chikeThis is not working for me. Term lineage is not saved after applying the patches above.
The maintainer of this module said repeatedly this module will NEVER save term lineage as a feature.
I will suggest using https://www.drupal.org/project/taxonomy_set_lineage together with shs to save the lineage.
Comment #7
summit commentedHi, great this solution is working for you.
For me because I had allready nodes with the lineage in drupal 6..7..it didn't work.
Now with both patches I can add new terms on node-edit page, and the term lineage is saved!
May be the term lineage could be placed in a submodule?
greetings, Martijn
Comment #8
chikePutting it in a submodule will be an excellent idea but I am not sure the maintainer will commit the patch. A better way will be to make a separate dependent module for it.
Comment #9
summit commentedHi, That would be awesome also!
Comment #10
joseph.olstadIf this is put into a sub module it would be more likely to be accepted, that way if it fails to work people can simply uninstall it.
Comment #11
joseph.olstadComment #12
joseph.olstadOk so three patches as mentioned by @Summit
Patch from
#2712115: Add functionality to add new terms
Patch from:
#3101263: SHS & select2 integration
Patch from:
#2943357: Save term lineage
Comment #14
joseph.olstadComment #15
heddnI'm not sure if it is a regression from this change, but even though I don't have
Allow creating new itemsselected, all of my SHS widgets display an Add new term option.Comment #16
heddnIt was introduced w/
2.0.0-rc5. RC4 is not impacted.Comment #17
liam morlandWith this change, when I try to delete a field or import config, I get this error:
I do not see this problem when I am running the previous commit of
shs.Comment #18
liam morlandComment #19
joseph.olstadok, reverting changes from 2.0.0-rc5
Comment #20
joseph.olstadnew release 2.0.0-rc7
Comment #21
joseph.olstadhttps://www.drupal.org/project/shs/releases/2.0.0-rc7
Comment #22
joseph.olstadok so no , not fixed
Comment #23
joseph.olstadso ya, this "new" is "new"
Comment #24
joseph.olstadok, tagging 2.0.0-rc8 with the exact same commit as 2.0.0-rc4
the "new term" functionality can stay parked in dev and the previous tags for now
Perhaps should be forked over to a 3.0.x branch instead and reset the 2.0.x branch back to 2.0.0-rc4
Comment #25
joseph.olstadrc8 is now exactly the same as rc4
https://www.drupal.org/project/shs/releases/2.0.0-rc8
Comment #26
joseph.olstadcreating a new branch for the new term functionality.
Comment #28
joseph.olstadReverted all the new functionality from 2.0.0-rc5 through 2.0.0-rc7
Reverted this also from 2.0.x
Added new branch, pushed all the new stuff into the new branch 3.0.x
Here is the bugfix release for 2.0.0, it is rc9
https://www.drupal.org/project/shs/releases/2.0.0-rc9
Comment #29
joseph.olstadComment #30
joseph.olstadComment #31
joseph.olstadRemoved from 2.0.x and not included in 2.0.0-rc9
Added to 3.0.x included in 3.0.0-alpha1
Comment #32
joseph.olstadComment #33
joseph.olstadit is in 3.0.0-alpha1, but since there's already reported issues, setting this back to active.
Comment #34
joseph.olstad@hedn
Thanks for reporting, I've ripped this out of 2.0.x and put it into 3.0.0-alpha2
I've created a followup bug issue with your feedback added.
#3436051: check term permissions to ensure that the add new term ui only shows up for those with those permissions
Comment #35
joseph.olstadComment #36
summit commentedHi, thanks for your renewed effort. I have it working using the patch I brought in. And it is only working when the Save New term option is triggered. I think putting this in a submodule is the best option, so people can choice to save new terms, or not.
I am not a programmer, but I can show screenshots of my site if needed? Greetings,
Comment #37
todea commentedFor some reason we don't see the "Save term lineage" setting on our field within "Manage form display". This happened when we were using 2.0.x-dev with the patches listed above and it is also happening now as we test the 3.0.0-alpha version.
Has anyone else run into this issue?
Comment #38
summit commentedHi,
I my case it kicks in without a setting. The vocabulary must allow adding new terms. I do not know exactly how my builder from Oekrain made it, but it is working.
Greetings,
Comment #39
joseph.olstad@todea , I have published alpha3 , it would have the same problem that you reported. Please open a new issue, I've starred this project so I will see it and I will review any submitted patches.
@Summit, can you please uninstall your patched version and try 3.0.0-alpha3 and report your findings?
Comment #40
summit commentedHi,
it is working fine at version 2.0.0-rc12 wiht the named 3 patches, and connects new terms to nodes.
However I have 4 layers of terms: country , region, province, place
When I add this as one within this great module.
So I add
in one, And click save
The result is a nicely one line country-region-province-new place interconnected
But when I look further and want to show the result as terms-lineage it only shows the deepest term.
Somehow using only one line the terms are not all exactly interconnected
When I add this as separate terms
So I type in 4 records. And click save
The result is a nicely one line country-region-province-new place interconnected
when I then look further the result is correctly the term-lineage and shown as term-lineage like country > region > province > place.
Can the patch be altered as such that only one line of input is necessary for this;
the country, the existing region, the existing province, the new place and still it gives the correct interconnection?
Thanks for integrating these patches and I will setup a testsite using version 3 the coming weeks, greetings,
Comment #41
joseph.olstad@summit, I specifically asked to test 3.0.0-alpha3 as this has the requested changes that you wanted. 2.0.x does not have these changes.
Comment #42
summit commentedI will set up a testsite to test this. Thanks for building this 3 branch! greetings,
Comment #43
summit commentedHi Joseph,
I set up a testsite with version 3.00.alpha3. It works as the patch, so https://www.drupal.org/project/shs/issues/3409930#comment-15848470 is still valid.
I only see somehow two issues:
- The newly added term is not shown in the new box, only when I click in the box I see my newly add term "Weibersbrunn (A place in the area aschaffenburg, in the province Beieren in the country Germany :) See attached image
https://www.drupal.org/files/issues/2024-11-08/fill-in-new%20place.jpg
- Somehow a second new term-add term box, is placed at the end of the working new term-add term box. I do not know if this is design on my part, I do not think so, because the patch itself doesn't show this? See attached images.
https://www.drupal.org/files/issues/2024-11-08/filled%20in%20new%20place...
https://www.drupal.org/files/issues/2024-11-08/empty%20code%20new%20term...
Greetings,
Comment #44
s3b0un3tHi,
I've updated the patch to make the save lineage feature work with version 2.0.5 of the module.
I'm uploading the patch here for anyone who might be interested.
Regards,
Comment #45
liam morland