0

I'm new to Drupal (using Drupal 8) and have been struggling to get content from a block I've create to display when accessing the view.

I've created a "service" view (page) which lives at the path "/service". I've configured the view to display the desired fields from the "service" content type. The view uses a contextual filter on the title of the "service" content type which allows clean URLs to work "/service/name-of-service"

The above works well. I'm running into problems with an "info" view (block) that I've created. The "info" block pulls in different fields from the same "service" content type. I decided to use a block for the remaining fields as it allowed me to place them in a specific block region that works for our desired page layout.

I've tried setting up a contextual filter in the block to filter by "ID" and provided a default value of "Content ID from URL", but I can't get this to work, no fields display at all. If I flip the setting to "Display all results for the specified field", fields do display, however, the content of the fields displaying in the "info" block is not pulling from the same node (because there is no contextual filter).

Is there a way I can setup a contextual filter to accomplish this? I've been able to use the contextual filter by ID successfully when working with the node itself, but can't get the same behavior when using views.

0

I was able to get this to work with the following contextual filter in my "info" block.

Filter by "Title" enter image description here

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.