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!

Comments

Summit created an issue. See original summary.

summit’s picture

StatusFileSize
new32.75 KB
summit’s picture

Issue summary: View changes
summit’s picture

Using also above patch, my composer.json file for SHS looks like this:

            "drupal/shs": {
                "#2712115: Add functionality to add new terms": "https://www.drupal.org/files/issues/2022-11-12/shs-add-new-term-functionality-2712115-66.patch",
                "#2712115: SHS & select2 integration": "https://www.drupal.org/files/issues/2023-10-02/shs-select2_integration-3101263-12.patch",
                "#2943357: Save term lineage": "https://www.drupal.org/files/issues/2023-12-20/save_term_lineage-2943357.patch"
            },

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,

summit’s picture

Status: Active » Reviewed & tested by the community

Hi, This is tested and ready. Greetings,

chike’s picture

This 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.

summit’s picture

Hi, 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

chike’s picture

Putting 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.

summit’s picture

Hi, That would be awesome also!

joseph.olstad’s picture

Status: Reviewed & tested by the community » Needs work

If 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.

joseph.olstad’s picture

Status: Needs work » Reviewed & tested by the community

joseph.olstad’s picture

Status: Needs review » Fixed
heddn’s picture

Issue summary: View changes
StatusFileSize
new8.88 KB

I'm not sure if it is a regression from this change, but even though I don't have Allow creating new items selected, all of my SHS widgets display an Add new term option.

heddn’s picture

It was introduced w/ 2.0.0-rc5. RC4 is not impacted.

liam morland’s picture

Category: Support request » Feature request

With this change, when I try to delete a field or import config, I get this error:

The "entity_reference_shs" plugin does not exist.

I do not see this problem when I am running the previous commit of shs.

liam morland’s picture

Status: Fixed » Active
joseph.olstad’s picture

ok, reverting changes from 2.0.0-rc5

joseph.olstad’s picture

new release 2.0.0-rc7

joseph.olstad’s picture

joseph.olstad’s picture

Status: Fixed » Active

ok so no , not fixed

joseph.olstad’s picture

so ya, this "new" is "new"

joseph.olstad’s picture

ok, 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

joseph.olstad’s picture

joseph.olstad’s picture

creating a new branch for the new term functionality.

  • joseph.olstad committed 4fe86cca on 2.0.x
    Revert "Issue #3409930 by Summit, chike: Save term lineage Drupal 10"...
joseph.olstad’s picture

Reverted 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

joseph.olstad’s picture

Version: 2.0.x-dev » 3.0.x-dev
joseph.olstad’s picture

Status: Active » Fixed
joseph.olstad’s picture

Removed from 2.0.x and not included in 2.0.0-rc9

Added to 3.0.x included in 3.0.0-alpha1

joseph.olstad’s picture

Version: 3.0.x-dev » 3.0.0-alpha1
joseph.olstad’s picture

Status: Fixed » Active

it is in 3.0.0-alpha1, but since there's already reported issues, setting this back to active.

joseph.olstad’s picture

@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

joseph.olstad’s picture

Version: 3.0.0-alpha1 » 3.0.0-alpha2
summit’s picture

Hi, 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,

todea’s picture

For 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?

summit’s picture

Hi,

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,

joseph.olstad’s picture

@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?

summit’s picture

Hi,
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

the country, the existing region, the existing province, the new place 

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

the country
the country and existing region 
the country and existing region and existing province
the country and existing region and existing province and new place

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,

joseph.olstad’s picture

@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.

summit’s picture

I will set up a testsite to test this. Thanks for building this 3 branch! greetings,

summit’s picture

StatusFileSize
new38.71 KB
new58.59 KB
new16.22 KB

Hi 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,

s3b0un3t’s picture

StatusFileSize
new17.95 KB

Hi,

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,

liam morland’s picture

Version: 3.0.0-alpha2 » 3.0.x-dev