Support SHS widget

Created on 3 December 2024, 4 months ago

Problem/Motivation

When SHS module ( https://www.drupal.org/project/shs ) is installed, this new widget does not appear as a possible widget in custom field subfields.

Steps to reproduce

Create a new field with a subfield that is an entity reference to a taxonomy term.
Install SHS module.
The new SHS widget does not appear as a possible choice for the subfield widget.

Proposed resolution

Support integration with SHS.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇮🇹Italy giuse69

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @giuse69
  • 🇺🇸United States apmsooner

    There's also this one: https://www.drupal.org/project/cshs . Need to research the best option to consider.

  • 🇮🇹Italy giuse69

    Yes, but CSHS does not fit for large taxonomies since it loads all the vocabulary terms and send them to the browser, the selection does not involve ajax loading while navigating the hierarchy.

  • 🇺🇸United States apmsooner

    I'm not going to integrate with SHS module. I don't particularly like the limitations with a single bundle requirement and I think theres a little too much going on with the approach not to mention the number of unresolved issues is concerning to me. I think I can create a much simpler alternative that serves the same basic need. Stay tuned.

  • Merge request !82First draft of hierarchical widget. → (Merged) created by apmsooner
  • 🇺🇸United States apmsooner

    This is first draft if you want to test out the patch. There's a few hardcoded styles just to get something visually appealing that I'll refactor but functionally... I think it's working really well. In the field settings, you'll see the new "Hierarchical select widget" as an option. Just use the default reference method for now as I haven't looked at the views option. There will be a couple extra settings at the bottom of the form:

    - Force deepest level
    - Show level labels

    I think the descriptions are self explanatory. Try it out and let me know how it works for you. It should support multi-lingual and work fine in paragraphs as well.

  • 🇮🇹Italy giuse69

    You're great! It works with a couple of issues:
    - language translation of taxonomy terms with Hierarchical formatter seems not to work here (always taxo term in default language is shown) but I think it's a problem of the formatter and not of this thread.
    - when used with flexbox formatter (not stacked), the series of selection boxes have a white space below the label that is not present in other subfield (like a select list) so the selection boxes are not aligned.
    cheers

    Giuse

  • Pipeline finished with Skipped
    3 months ago
    #380828
  • 🇺🇸United States apmsooner

    The translations are working just fine in the widget as well as the formatter in my testing. The widget now supports views to control the 1st level of hierarchy although in most cases, the default formatter should be sufficient as we're only fetching the terms for each level to help with performance.

Production build 0.71.5 2024