Reputation: 149
The note entities already have fields in them to reference another entity of any type, so a note can be linked to a node, a user, an order any other entity type is saved in field "entity" and "entity_id" keeps id of linked entity.
How to define relationships for views module, so we can load fields of other linked entities when we build a view of notes?
Upvotes: 0
Views: 657
Reputation: 2015
The way the relationships work in views are the following:
Under the 'Advanced' section of the view, you can add a relationship by selecting the reference field in question (for example a user reference, node reference, etc). In the screen to configure the relationship you can name your relationship (if you don't like the default name) and choose whether you want to limit your view only to nodes that have that field/relationship filled in!
Now comes the good part: after setting up the relationship, you'll see a bunch of new fields appear in your list of fields to add to your view that are present from the referenced entity. If you select any of these fields from the referenced entity, however, you have to specify to the view that it needs to use the created relationship, or they will simply be empty:
Upvotes: 1