Getting views contextual filter from url for display suite block I have a URL for an event content type that concatenates two other content types, namely "name-of-venue" and "name-of-performer" with "date-of-event", so the url is "name-of-venue/name-of-performer/dateofevent".

I wish to place a block on the event content type that shows only the events for that venue.

I have tried to configure the contextual filter as shown on the screen shot,



using the PHP code:


  $np = explode('/', drupal_get_normal_path($argument)); if
  (!empty($np[3])) {   $handler->argument = $np[3];   return TRUE; }
  else {   return FALSE; }


However this does not return just those events for that specific venue, but for all venues.

Consequently I fear that I am not actually exploding the url and so failing to obtain the NID for "name-of-venue" that I need for the contextual filter.

Any suggestions would be very much appreciated.

Thank you.
Here is a kind-of-complex sketch for your problem, using only Views:


Create a block view displaying Content of type Event
Add a "Content: Nid" contextual filter, using the default settings. You may need to set the default value to "Content ID from URL" for the case "When the filter value is NOT available"
In your View configuration, under "Relationships", create a "Entity Reference: Referenced entity" relationship for your reference field (e.g. field_venue) and click on "Require this relationship": This relationship will retrieve the venue of the Event that is defined from the contextual filter.
Create a second relationship, one of type "Entity Reference: Referencing entity", again for your reference field (e.g. field_venue) and click on "Require this relationship". Important: Use the first relationship (step 3) for this one: This second relationship will retrieve the events that reference the venue we got from the first relationship.
Set your Views format to use fields (either by using a Table or by ticking the "Force using fields" option). 
Add the fields you want to display and select the second relationship you created for them.


At this point your block should list all events for the venue of your current event. The problem that still remains is excluding the current event from that list. Follow steps take care of that:


Add two "Content: Nid" fields, set one of them to use the second relationship and exlude them from display.
Set a "Global: Fields comparison" filter and set it to filter out rows when the two excluded fields from above are equal: This will take care of excluding the actual event from showing in the block.


Once you place this block inside an event node page, it should display a list of Events from the same venue excluding the current event.

Cheers and let me know how this goes.



Appendix A:







Appendix B: