Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll
10/10/2019, by mikhail

Relationships are a very important part of Drupal, so taxonomy terms and content, users and content, goods and the display of goods in commerce are combined. Thanks to this, we can display user fields when displaying material fields, and when displaying goods, we can display their price and article number.

Thanks to this, we can display user fields when displaying material fields, and when displaying goods, we can display their price and article number.

relationships

Let's create a view that will display information about the user who created the material on the page of which we are located in the block. In one of the previous lessons we have already figured out how to use the context filter and display the information about the page we are on:

http://drupalbook.org/drupal/353-views-arguments-contextual-filters

Name of the view: Author's information
Machine name: athor_info
View Settings: Contents, Announcements
Create a block, with one entry. 

Now you need to add a context filter by Content: ID:

views

Now you need to add a context filter by Content: Content ID:

filter

As in the last article, let's set the Provide default value: Content ID from URL.

We now have the node fields available on the page where we are located. But we need the author's fields. At the moment we can only access the author's UID field:

authored by

It's time to add the author's relationships:

content author

After that we will be able to add the node author's fields: avatar, name, date of the last visit to the site and other fields. When you add its fields, the view automatically exposes the field of relationships:

relationship

I've added several fields at once:

Contents: Authored by

(author) User: Picture

(author) User: UUID

(author) User: User status

(author) User: Name

(author) User: Updated date

Let's now display this block on the announcements page. You can set a block in the visibility area so that it is displayed only on the content tupe in the announcements.

block

That's it, we've figured out how to use the relationships in the view, and later on we'll use them more than once, so if not everything is clear now, just move on to the next article.