- ๐ฎ๐ณIndia ravi kant Jaipur
Views Relationships allow you to create connections between different entities (content types, users, taxonomy terms, etc.) and access their fields in a view. By establishing relationships, you can fetch and display related data from multiple entities within a single view.
To set up a relationship in Drupal Views, follow these steps:
- Create a new view or edit an existing view in the Views interface.
- In the view's configuration, locate the "Advanced" section and click on it to expand the options.
- Click on the "Add" button next to the "Relationships" fieldset.
- A dialog box will appear with a list of available relationships based on the selected base table (content type). You can choose a relationship based on the entity you want to establish a connection with. For example, if you want to display a field from a referenced entity, you would select the appropriate relationship related to that entity.
- After selecting a relationship, click on the "Apply" button to save it.
- Once the relationship is added, you can now add fields, filters, or contextual filters that use the newly established relationship.
- To add a field related to the relationship, go to the "Fields" section, click on the "Add" button, and you will see new field options available under the relationship's heading. Choose the desired field and configure its settings.
- To add a filter using the relationship, go to the "Filters" section, click on the "Add" button, and select the filter criteria from the available options under the relationship's heading. Configure the filter settings as needed.
- Similarly, you can add contextual filters that use the relationship to dynamically filter the view results based on the context provided. This can be done in the "Contextual filters" section.
- Save the view and preview it to see the results of the relationship-based configuration.
- Status changed to Needs review
almost 2 years ago 6:17am 19 June 2023 - Status changed to Needs work
almost 2 years ago 6:23am 19 June 2023 - ๐ฉ๐ชGermany Anybody Porta Westfalica
Thanks @ravi kant.
Looking at the code, I think the module only introduces a link between nodes and their representing menu entry:
https://git.drupalcode.org/project/views_menu_relationship/-/blob/8.x-1....But please have a look and try yourself for details.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
(I am removing a tag, since tags should not duplicate what already selected for the Component field. I apologize for bumping this issue.)
- ๐ฌ๐งUnited Kingdom robbm
According to views_menu_relationship.info.yml, this module "Enables sorting views by the menu order of nodes".
However, having installed it, I'm not seeing any option to do so. Therefore, some basic documentation would undoubtedly be useful (assuming that it actually does do what it saysโฆ)
- ๐ฉ๐ชGermany Anybody Porta Westfalica
Thanks @RobbM, indeed we should add a README.md, a Screenshot and a better description to the module page.
Code-wise the module is as simple as this: https://git.drupalcode.org/project/views_menu_relationship/-/blob/8.x-1....
It add the menu_link_content table to views and a relation on nodes.
I don't currently have the time to write that documentation, so tagging this as novice, perhaps someone can simply start from the code, install the module, understand how it works and provide the requested information here. - ๐ฌ๐งUnited Kingdom robbm
"It add the menu_link_content table to views and a relation on nodes."
Does it actually do that for you? I'm not seeing anything here โ i.e. when creating a view of Content (nodes) and adding a Relationship, I expected to see an option for Menu Tree, but do not.
I'm currently tempted to raise a critical bug report to that effect, but maybe I'm missing somethingโฆ
(Fortunately, I seem to have achieved the intended result with a combination of Menu Entity Index โ and Views Tree โ .)
- ๐ฉ๐ชGermany Anybody Porta Westfalica
Thanks @RobbM - I didn't use the module for some time, we should check that again.
Rasing a critical issue doesn't help a lot IMHO, if the module simply does nothing. But someone needs to take the time to look into it technically, which I currently don't have the time for.
- ๐บ๐ธUnited States cedewey Denver, CO
I've also tested out this module and cannot find any added functionality after enabling it. I created a View and looked throughout its options and there was nothing related to menus provided.
- ๐ฉ๐ชGermany Anybody Porta Westfalica
Yes I can confirm it doesn't seem to work (anymore)... hope someone will find the time to find out why and fix it.
Would be great to have a relationship from menu entities to other entities and the other way around.