With Display Suite Extra, we can turn on the View mode switcher which allows site visitor to view different view mode of a content type ajaxly.
Now i got 2 views blocks with nid being set as contextual filter. I have added the 2 blocks on 2 different view modes and I expect the blocks will only show the content of the current node. But when the other view mode is loaded thru Ajax, it the the contextual filter doesn’t work.
One workaround is to get the nid from the url and set it as the default input of the contextual nid filter.
// Get the nid from the ajax call request if (isset($_GET["id"])) { return $_GET["id"]; } return null;
Done =)
Reference: Switch View Modes not working with views looking for NID from url
Great solution!
Is this possible with the contextual filter “Has Taxonomy Term ID” too?
// Sven
LikeLike
I think it’s possible. In the PHP contextual filter code, you could load the the node content base on the nid and return the the term id if it exists.
LikeLike