With https://www.drupal.org/community/events/drupal-10-global-porting-day-jul... coming up and https://www.drupal.org/about/core/blog/the-project-update-bot-is-being-r... starting to create automated update suggestion issues like #3290652: Automated Drupal 10 compatibility fixes and #3290604: Automated Drupal 10 compatibility fixes, it's time to start looking at D10.
I updated `core_version_requirement: ^8.8 || ^9 || ^10` in shs.info.yml, but to get an idea of how much work this is going to be. The field configuration worked fine.

However when adding or editing the content type with the field configure to use SHS in the form display, the field is rendered as just a text field. If you add a valid term id, the node will be saved and render as expected.

Somehow no errors are generated.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | shs-chosen-d10-compatibility-3295761-15000565.patch | 758 bytes | almador |
| #14 | widget_settings.jpg | 87.65 KB | almador |
| #9 | D10_Functionality-Check_Shs.png | 22.85 KB | tushar1 |
| #8 | shs_d10_compatibility_issue_fixes-3295761-8.patch | 7.79 KB | rahul17 |
| #4 | shs_d10_compatibility_issue_fixes-3349877-1.patch | 8.77 KB | rahul17 |
Issue fork shs-3295761
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
oheller commentedIf you open the browser inspector, you will see an error about Once not being a function. This is because jquery.once has been removed from core: https://www.drupal.org/node/3158256.
We need to update the library to call core/once and update AppView.js, around ln:42 to properly use once. I've tried but haven't succeeded yet.
Comment #3
oheller commentedWe have updated the js/views/AppView.js LN: 44 with:
This adds the hidden class but we don't have the taxonomy terms added to the containers.
Comment #4
rahul17 commentedCreated a patch for Drupal 10 Compatibility Fixes, please review.
Comment #5
kreynen commented@rahul1707 was that patch created from the current 2.0.x branch?
I've created an issue branch and started making the changes there. If you could use that as a starting point, I'm happy to review.
Comment #6
godotislateUpgrade status has these D10 compatibility warnings against 2.0.0-rc3, and on a quick look, they still seem to apply to latest 2.0.x-dev
Replacing
jquery.onceshould be relatively straightforward. The larger issue is replacingcore/backbone. There seems to be three ways forward:core/backbonedependency withcore/internal.backbone. This would mean requiring at least D9.4. It is also highly discouraged by core maintainers to do this. #3258931: Deprecate backbone and tag it internalSeems like the last one could be a separate issue to do over a longer term, and possibly be done in a 3.0.x branch. But in order to be D10 compatible in the short term, perhaps one of the first two approaches could be a short term fix?
Comment #7
godotislateAlso caught these two lines that need updating per Creating an instance of the class Drupal\Core\Database\Query\Condition with the new keyword is deprecated and an API addition with the method Drupal\Core\Database\Query\Query::getConnection():
Drupal\shs_chosen\Plugin\views\filter\ShsChosenTaxonomyIndexTidDepth
l. 139
$or_condition = new Condition('OR');Drupal\shs\Plugin\views\filter\ShsTaxonomyIndexTidDepth
l. 141
$or_condition = new Condition('OR');Replacement for both should probably be
$or_condition = $this->database->condition('OR');Comment #8
rahul17 commentedCreated patch for 2.0.x-dev to fix Drupal 10 compatibility issues. Please review it.
Comment #9
tushar1 commentedI have tested patch on latest 2x version which is applied cleany and working as expected on Drupal 9 & 10..making it RTBC
Comment #10
j. commentedPatch is apply and no issues on D10.
Comment #11
kreynen commented"No issues" meaning SHS is fully functional?
Comment #12
j. commentedCorrect.
Comment #13
kars4 commentedIt is not fully functional for me.
Not working Chosen widget and creating new items.
Comment #14
almador commentedHi, rahul1707, and thank you so much for the patch!
I'm using the latest shs-2.0.0-rc3 with your patch and I can confirm that it works with selecting hierarchical items.
BUT when I'm trying to allow creating new items on the form display widget:
admin/structure/types/manage/article/form-display
"Allow creating new items
Allow users to create new items of the source bundle."
widget checkbox is gray and not available
p.s. found this, so maybe it's not the patch problem:
related issue
p.s.2 if someone is looking for a solution the patch from here:
https://www.drupal.org/files/issues/2022-11-12/shs-add-new-term-function...
working!
Comment #15
almador commentedThis patch should help with shs_chosen search not working
Comment #17
kreynen commentedChosen still seems buggy, but core SHS functionality seems to be working as expected in D10. I haven't tested in D9 yet. I opened an MR to the 2.x branch. Not sure if that's the direction @stBorchert and @jhedstrom want to do with this, but this unblocks me on #3290652: Automated Drupal 10 compatibility fixes. If we want to push these changes to a 3.x branch and make that D10 only, I'm happy to help with that.
HUGE thanks to everyone who has contributed!
Comment #20
jhedstromThanks all!
Comment #21
aneida commentedHi, remember 'static' return type declaration is only allowed since PHP 8.0
In php 7.4 not working.
Comment #22
kreynen commented@Aneida That's what I was afraid of. There's only 4 months of D7 support left, but trying to keep everything work with D9/PHP7 and D10/PHP8.1 is challenging. Probably should have gone with a 3.0.x release for D10.
Comment #23
aneida commentedAnother way would be to add the composer.json file, where the minimum php requirement is indicated. This way, you avoid creating a version that as you mention, will lose maintenance.
https://www.drupal.org/docs/develop/creating-modules/let-drupal-know-abo...
Greetings.