Tree
Last updated on
30 April 2025
The Tree module lets you restructure a hierarchy of nodes with Entity Reference relationships using dragging in Views.
- Enable Views, Entity Reference, Tree and Tree Field.
- Create a content type with an Entity Reference field (e.g. parent). If your hierarchy includes different bundles, ensure the same field's attached to all the bundles, even bundles that are always roots of the tree.
- Check the "Tree field" checkbox in the "ADDITIONAL BEHAVIORS" section and choose "Nested set". Nested set is an SQL implementation of the nested set model.
- Save the field and content type
- Create some nodes of this content type where the parent field references other nodes of this type
- Create a new view with that content type with a page display
- Add a URL for the page
- Add the content title to the fields
- Add the Entity Reference field (e.g. parent) to the fields
- Add a Tree: Draggable field to the fields
- Add a Tree: Nested tree relationship.
- Sort the view by Tree order sort using the relationship you just set up.
- Choose the Table format
- Save the view
- Go to the views page
- Drag around your nodes
- Click Save button to save the Entity Reference fields
- You will see that the Entity Reference fields (e.g. parent) changed based on how you moved around the nodes.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion