I am using Drupal 10 to build a web site that will act as a virtual guide for a touristic destination, e.g. Island-X.
The user, who is going to be the potential visitor of the destination, will be able to explore the island by following some suggested Routes. On each Route he will be able to explore a specific area and see/visit any Points of Interest alongside. So there are two basic content types (listing some of their custom fields below):
Route
- Locations
- Route Type (entity reference, taxonomy term)
- Length
POI
- Location
- POI Type (entity reference, taxonomy term)
- Geoaddress
- Relevant Routes (entity reference, content: Route) - Multiple
So, a Route can have multiple POIs and a POI can belong to multiple Routes (many to many relationship).
I have selected to implement this relationship by adding the field "Relevant Routes" as a custom field for POI as shown above. So for each POI I can select the Route(s) in which it will appear.
Also, I have two taxonomies: Route Type & POI Type, each defining distinct types of content, e.g.:
Route Type
- Wine (Thematic Route)
- Geology (Thematic Route)
- Gastronomy (Thematic Route)
- Religious (Thematic Route)
- Agrotourism (Thematic Route)
- Culture (Thematic Route)
- Routes by Car/Motorbike
POI Type (the terms: Nature, Culture are only used for grouping different kind of POIs)
- Nature
- Gorge
- Mountain
- Plateau
- Cave
- Beach
- Ecosystem
- Culture
- Archaeological Site
- Museum
- Monastery
- Monument
Now, for each Route node (so, when a user is in the full page of a Route content item) I want to display in the sidebar two blocks with links:
Nature (Block Title)
- Gorges (link to a listing page with POIs of: POI Type=Gorge, Relevant Routes=current Route node)
- Mountains
- Plateaus
- Caves
- Beaches
- Ecosystems
Culture (Block Title)
- Archaeological Sites
- Museums
- Monasteries
- Monuments
These blocks will act like sidebar menus (for each node of type Route) and each link will lead into a listing page with all POIs (of the specific type) for which the Relevant Routes field has the value of the current Route node.
How can I achieve this? I assume I should use "Views" for that purpose of type "Block".
I have tried the following configuration to create the View for the Nature POIs:
View
- Title: [Sidebar Route - Nature POIs]
Format
- Format: Unformatted list
- Show: Fields
Fields
- Content: POI Type (POI) - Aggregation settings: Group together by Target_id
Filter Criteria
- Content: Published(=Yes)
- Content: Type (POI)
Advanced - Relationships
- field_poi_relevant_routes: Content
Advanced - Contextual Filters
- Content: ID
- using relationship field_poi_relevant_routes
- Provide default value: Content ID from URL
Advanced - Other
- Use Aggregation: Yes (to group together items with the same POI Type and display it once)
But obviously I am not getting the result I need. More specifically, I am getting multiple times the POI Type term in the respective block (so it seems that aggregation is not working) and then when I click onto the term, in the listing page I am getting ALL the POIs.
Can you please help on that? I am new to Drupal and especially views.