0

I have 2 content types: Artist & Artwork

Artwork contains an Entity reference field pointing to a single Artist called "Artist"

I have 2 views:

  1. Artist Detail - A page view showing a single artist using title (artist's name) as contextual filter so url is human readable. eg. myexhibit/pablo-picasso
  2. All artwork by an artist - A block view listing art by a specific artist using the "Artist" Entity reference field as contextual filter

I want to embed view #2 into the header of view #1 so that art tied to that artist appears on the Artist Detail page view.

I can get it to work if I change my filter on #1 to filter by Node ID and then pass that Contextual Filter to the embedded view. But I don't really want my URL to be myexhibit/213.

Is there a way to pass the node ID of the node matching the argument "pablo-picasso" to the embedded view? Or a way to get the embedded view's contextual filter to work using a node title rather than the NID referenced in the Entity Reference field?

2
  • By which way did you create Artist Detail page?
    – ya.teck
    Aug 1, 2013 at 16:11
  • It's a page view. Basically display Artist content type only showing the Artist whose "title" appears as an argument in the url. So myexhbit/pablo-picasso shows only the Artist node titled "Pablo Picasso". I am using a view to accomplish this rather than just a default "Artist" page because I want only certain artists tied to a specific exhibition to have artist detail pages.
    – Tantalus
    Aug 1, 2013 at 16:16

2 Answers 2

1

You can use myexhibit/NID url for this view page and then set up an alias (for example myexhibit/TITLE). If you want to make this page only for certain artists you can filter them by node ID.

3
  • Thanks. This would work, but creating many aliases is more effort for my client than than it would be worth to maintain human-reabable URLs.
    – Tantalus
    Aug 2, 2013 at 16:50
  • I think pathauto module can help you.
    – ya.teck
    Aug 2, 2013 at 19:08
  • Pathauto solution works but is a heavy-handed way to do something that I know has to have a more automated solution. My guess is that the answer lies somewhere in the PHP Validation of the contextual filter. Something along the lines of "If $argument is not a number, get node by title (the title being the argument), pass that node's NID as the argument to the sub-views"
    – Tantalus
    Aug 8, 2013 at 19:12
0

The embedded view doesn't work with node title argument because it's a title of parent node (Artist). To get it working you should add relation to the Artist node type and specify it in argument settings.

1
  • Sounds logically, yet it doesn't work as it supposed to be. I guess it needs more than that, PHP code validation I'm afraid - no out of the box solution. Jun 19, 2015 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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