I want to list all the nodes that have the currently viewed node as their parent.
To make this more tangible and less abstract, let's do an example:
I have a content type Locations
which has an Entity Reference field called parent_location
with an unlimited number of values.
For example:
- USA (3) [country level]
- New York (4) [state level]
- New York City (6) [city level]
- Central Park (8) [landmark level]
- Empire State Building (9) [landmark level]
- Times Square (10) [landmark level]
- Illinois (5) [state level]
- Chicago (7) [city level]
- Sears Tower (11) [landmark level]
- That bean looking thing (12) [landmark level]
So when I view the content for USA (3), I wanna list all the children, meaning New York (4) and Illinois (5).
When I view New York City (6) I want to list Central Park (8), Empire State Building (9), and Times Square (10).
I want these to show up when I view /node/6
and be clickable, so that I can browse this nested child/parent structure.
It's already possible by default to traverse UP on the tree. Meaning I can easily get from Times Square (10) all the way up to USA (3).
However, I can't figure out how to list all children of the appropriate level!
I did create a block view called List Child Locations
. And I've placed this view on the block Content
. It shows up correctly, but it does not list the appropriate children.
When it comes to editing my view, I have no clue what I'm doing or how...
I see there's two options:
admin/structure/views/view/list_child_locations/edit/block_1
and
admin/structure/views/view/list_child_locations/edit/entity_reference_1
I think I have to do something with contextual filters, while I'm in the Entity Reference Display. But I can't find anything that looks like what I need...
Out of all those many options, which one do I chose to make sure it does something like
SELECT * from Locations WHERE parent_location = %current_location%
?
What's the right settings for my entity display to only list the children?