When DraggableViews is used with another Content entity (non-node) errors are shown when the hierarchy functionality is used. The Drupal\draggableviews\DraggableViews class seems to assume an identifier is always called 'nid', while it can have arbitrary names.
I think the solution should be to inspect the view's base entity type for the identifier field, and use that field in the depth calculation.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | draggableviews-use-entity-identifier-2985291-3.patch | 2.62 KB | marcus_w |
| #2 | draggableviews-use-entity-identifier-2985291-1.patch | 2.59 KB | marcus_w |
Issue fork draggableviews-2985291
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
marcus_w commentedPatch is attached
Comment #3
marcus_w commentedAdded fix for infinite depth
Comment #4
nicxvan commentedComment #5
mandclu commentedComment #6
tonka67 commentedThanks for reopening this. Looks like there's been a reversion in DraggableViews 2.1.4. I'm pulling the following error again:
Warning: Undefined property: Drupal\views\ResultRow::$nid in Drupal\draggableviews\DraggableViews->getIndex() (line 44 of /code/web/modules/contrib/draggableviews/src/DraggableViews.php)
Comment #7
istryker commentedIs this a duplicate of #3158196: Allow any entity in DraggableViews::getIndex(). To me it looks the same, but this one tries to make hierarchery work
Comment #11
istryker commentedI fixed things up a little. I renamed everything 'base view entity id' cause that's what it is. This should support any entity type that can be a view. The only thing that might be a problem is crossing different type of relationships in the view. I am not too worried about this though, as that is probably already broken.