Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm about to write a subclass of the UI controller for an entity that needs a draggable table on its admin page to order & place the entities in a hierarchy -- much like taxonomy terms.
It occurs to me that this could be made generic and available as a subclass in Entity API module.
If you're interested, I can write this as a patch for Entity API :)
Comments
Comment #1
joachim CreditAttribution: joachim commentedHere's how I reckon this could work:
- In the entity info 'entity keys', add 'weight' and 'parent' items.
- In the entity info 'admin ui' section, add:
- 'draggable' => TRUE
- 'hierarchy' => TRUE
Thus modules like profile2 could use just the 'draggable' part.
Comment #2
rerooting CreditAttribution: rerooting commentedOoh I like I like. I'll see how I can help!
Our good friends at the examples module might provide some inspiration...
http://drupalcode.org/project/examples.git/tree/refs/heads/7.x-1.x:/tabl...
Another interesting thing to note is that the weight item could be used for a generic tablesort ability as well. They might just be 'draggable' => TRUE; 'hierarchy' => FALSE (Though the proper lingo might be something more like 'sortable' => TRUE)?
Comment #3
joachim CreditAttribution: joachim commentedThis should take into account possible CSS tweaking from #1437272: Provide a description entity key especially for use with exportable entites (e.g. as seen in node types).
Comment #4
BruceDawson CreditAttribution: BruceDawson commentedWould it be possible to make fields "inheritable" to children?