Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module allows you to create deeply nested, hierarchical structures within a single entity reference field. It provides a drag-and-drop interface for managing the hierarchy and integrates with revisions and other modules for advanced content modeling.

The Entity Reference (with) Hierarchy module extends Drupal core's standard entity reference field, transforming it from a flat, linear list into a powerful rooted tree structure.

While Drupal core only supports simple lists of references, this module allows you to define complex hierarchies directly within a single field on the host entity.

Architecture: The Rooted Tree Approach

Unlike other hierarchy solutions that create "nested sets" by chaining reference fields across multiple individual entities, this module manages the entire hierarchy map via a single field. This rooted tree architecture stores depth and weight metadata alongside the target ID on the primary entity.

This approach is exceptionally well-suited for Paragraphs, where you may need to manage deeply nested layouts and components without the overhead of cross-entity field chaining.

Key Features

  • Visual Hierarchy Management: Includes a drag-and-drop interface identical to the familiar UI used for managing taxonomy terms or menu links in Drupal core.
  • Single-Field Data Model: The entire tree is stored and managed on the root host entity.
  • Revision Support: Fully compatible with Entity Reference Revisions, allowing for historical tracking and revisioning of the entire hierarchical structure.
  • Ecosystem Ready: Works seamlessly with Inline Entity Form and Paragraphs for advanced content modeling.

Example Structure

The module tracks both delta (weight) and depth to maintain the tree:

  • Reference A (delta 0, depth 0)
    • Reference B (delta 1, depth 1)
    • Reference C (delta 2, depth 1)
      • Reference D (delta 5, depth 2)
  • Reference E (delta 3, depth 0)

Comparison to Entity Hierarchy

It is important to distinguish this module from Entity Hierarchy:

  • Entity Hierarchy creates trees through a chain of reference fields pointing to one another (a nested set model).
  • Entity Reference (with) Hierarchy uses a single field on the primary entity to manage the structure (a rooted tree).

Background & Credits

This project was born from a desire to create a more generic, unstyled version of Bricks. During development, it incorporated improvements and logic inspired by the entity_reference_hierarchy repository by maijs.

Activity

Total releases
2
First release
Jan 2026
Latest release
2 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.1 Stable Apr 20, 2026
1.0.0 Stable Jan 25, 2026