1

I want to have the same style of block for similar content type but the matter should be different.

For instance, I have a content type of hotel which has different fields in it and I have created a view for list of hotels. Now what I want to do is display the information of of some field from hotel(say Brochure as pdf) as a block when that particular hotel info is requested, rest as content itself.

I know one way of doing it is creating a custom block and restricting it to particular url. But it is too hectic. Is there a simple way of connecting the field from content to the block to that particular content display?

Personal observation: I have tried to place the block(say sidebar first) of content type in "block layouts". Though it shows up, no luck in placing it.

1

The easiest way is with a View.

  • Create a new view
  • Disable the Page that will be checked by default.
  • The view should take as argument the Node ID.
  • Also add a filter based on the content type
  • Then in the view, add the fields you want (File, PDF)
  • On the top (+ Add next to Master), you need to add a display as a block

Now, you go to /admin/structure/blocks and add the block. Filter it by Content Type.

:)

Views module - https://www.drupal.org/project/views

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.