I want to create an advanced view in Drupal 8 using relationships and contextual filters, but I can't.
I have three types of content:
Testimonials may cover programs and modules, and when added to the site, the author selects which modules and programs the testimony applies to. This is done through an entity reference field in Testimonial that allows you to select the Programs and Modules to which it applies (I can change this if necessary, this is under development).
In addition, programs allow you to configure which modules are part of them.
Both programs and modules are configured to use the Pathauto URLs of the format
I want to create a block view that shows all the testimonials that apply to the program or module that is currently displayed (I will control it through the settings for what type of content the block will display).
If the node shown is a module, I want to show only the testimonials that apply to that module.
If the node shown is a program, I want to show all the testimonials that apply to the program and all its related modules.
If the node shown is the main page, I want it to show all the testimonials, regardless of the modules and / or programs configured.
I came to add a relationship to the view (of the Teasers type of testimonials) that points to the content referenced in the reference field of the entity mentioned above, and a simple contextual filter based on the identification of the node (see below ).
1. Pathauto problem
I can configure the context filter to
/node/ Style URLs and simple filtering are performed for the node that is currently displayed. But I can't get the filtering to occur when I want to use Pathauto URLs. This suggestion came a little closer, this led me to the right direction, but not quite.
I am aware that the elegant "Gross URL value" option to configure when the filter is unavailable has a checkbox for "Use route aliases", but I could not find any explanation of its behavior or the relationship / interference with the sibling option "Numbering of route components".
There is also the option to configure a validator, as mentioned in the last reference I provided, but that reference refers to taxonomies while dealing with Pathauto URLs … There is a Pathauto validator, but I have no idea what . make.
All I want is for the pathauto URL to be translated in some way into the node ID so that it is available for contextual filtering! Argh!
2. Types of hierarchical content.
How do I add relationships (I suppose that is what I need to do) to get the desired result to show specific testimonials of the Module for a node of the Module shown, or testimonials related to the Module and the Program when a Program node is shown?
Somehow, I never managed to break the mental image or the concept of relationships in Views, they seem very little intuitive …
Thanks for any help on this.