fields of content type show as sidebar menu in drupal

574 views Asked by At

I am newbie in drupal I learned how to create content types, but I need do it: I have the content type project with fields location, arquitect, images, contact, saler, etc each field is text with google maps reference, the profile of arquitect responsable, imageg of project, info of contact, saler profile respectively I need to show this info in this way. How Can I do this? I am usin Drupal 8 enter image description here

1

There are 1 answers

7
Nikola Kirincic On

You can achieve this by installing and setting 'Views' module: https://www.drupal.org/project/views, then to create new view with block display that will show fields only for current node ID of your specific node type by using contextual filter in advanced section when editing views:

You can setup your view block like this:

You can setup your view block like this

Add in contextual filters node nid:

Add in contextual filters node nid

For this contextual filter, select provide default value of type PHP code and set to retrieve it through arg(1):

For this contextual filter, select provide default value of type PHP code and set to retrieve it through arg(1)

When you finish setup your view, your block will appear under blocks, so you can assign it to region you want to, i.e. sidebar.

If you want to, you can restrict visibility for specific content type.

For drupal 8 it is content -> ID, then select "Provide Default Value" when the filter value is not available, and under type select "Content ID from URL"

Under section advanced, add new contextual filter

Under section advanced, add new contextual filter

Choose Content: ID

Choose Content: ID

Choose provide default value and Content ID from url

Choose provide default value and Content ID from url