The Tree module lets you restructure a hierarchy of nodes with Entity Reference relationships using dragging in Views.

  1. Enable Views, Entity Reference, Tree and Tree Field.
  2. 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.
  3. 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.
  4. Save the field and content type
  5. Create some nodes of this content type where the parent field references other nodes of this type
  6. Create a new view with that content type with a page display
  7. Add a URL for the page
  8. Add the content title to the fields
  9. Add the Entity Reference field (e.g. parent) to the fields
  10. Add a Tree: Draggable field to the fields
  11. Add a Tree: Nested tree relationship.
  12. Sort the view by Tree order sort using the relationship you just set up.
  13. Choose the Table format
  14. Save the view
  15. Go to the views page
  16. Drag around your nodes
  17. Click Save button to save the Entity Reference fields
  18. You will see that the Entity Reference fields (e.g. parent) changed based on how you moved around the nodes.

Comments

cristiroma’s picture

Hi, I've followed your tutorial:

1. View screenshot: http://s27.postimg.org/e43tonuhv/Screen_Shot_2014_07_20_at_10_29_09_am.png
2. Front-end screenshot: http://s27.postimg.org/nndii4i03/Screen_Shot_2014_07_20_at_10_29_49_am.png (+ Save button)

You mention about dragging around the nodes, but it seems not possible. Did I miss something?

Using Drupal 7.28 + tree-7.x-1.x-dev,
I tried with 1.0-alpha1 but I cannot add content, because requires selecting a parent (first node cannot have parent so - select control is empty)

Thank you for support!
Cristian

mmmikko’s picture

I have an idea of cooperative content creation in groups and this would really help testing it out.