hierarchical_select_ajax
No security coverage
The Hierarchical Select Ajax module provides a dynamic, AJAX-powered field widget and formatter for taxonomy term reference fields. It is designed to enhance the user experience when dealing with deep or complex taxonomy structures by loading child terms only when needed.
Key Features
- AJAX-Powered Widget: Choose terms level-by-level using standard select elements that update dynamically via AJAX.
- Customizable Depth: Limit the hierarchy depth to a specific level or allow full traversal.
- Per-Level Customization:
- Labels: Define unique labels for each level of the hierarchy (e.g., "Country", "State", "City").
- Descriptions: Add specific help text for each level.
- "No Selection" Labels: Customize the empty option text per level (e.g., "- Select a Country -", "- Select a State -").
- Deepest Selection Support: Options to manage how values are saved based on the nesting level.
- SHS-Style Formatter: Includes a Simple Hierarchical Select (SHS) style formatter for consistent display of the term hierarchy on the frontend.
- Developer Friendly:
- Exposes hooks (
hook_hierarchical_select_ajax_element_alterandhook_hierarchical_select_ajax_settings_alter) to programmatically customize the element behavior and settings. - Clean, trait-based implementation for easy extension.
- Exposes hooks (
- Lightweight & Fast: Only loads the terms required for the current selection context, minimizing initial page load.
Installation & Configuration
- Enable the module as usual.
- Go to the "Manage Form Display" tab of your entity (e.g., Content Type, Media Type).
- Select Hierarchical select ajax as the widget for your taxonomy term reference field.
- Click the cog icon to configure the hierarchy depth and per-level labels.
- (Optional) Go to the "Manage Display" tab and select Hierarchical select ajax SHS as the formatter to display the hierarchy.
Requirements
- Drupal 9, 10, or 11.
- Core Taxonomy module.
Similar Modules
While similar to modules like Simple Hierarchical Select (SHS) or Client-side Hierarchical Select, this module focuses on a robust backend AJAX implementation with granular per-level configuration and developer-centric extensibility.