1

I don’t want to link to the original piece of content (which is a join table) but to the content type which is referenced in the join table.

Using: Views, Entity Reference, Entity Tokens, Token.

I have these content types:
- Person (firstname, lastname, etc.)
- Story (field_story_title, orig copyright, description, etc.) Note: [content:title] is automatically generated and not used.
And this content type which functions as a join table
- PersonStory (field_personstory_person_id, field_personstory_ story_id, relationship [e.g. author].)

The view has Content: Type (= PersonStory)
Relationships have been created
- Story from field_personstory_story_id
- Person from field_personstory_person_id

The view successfully finds Story Title (field_story_title) and Person Name (using [Global: custom text] in concatenation of field_person_lastname, field_person_firstname, etc).

I created a link:
- Added field [content:path] above Story Title on the field list. Checked "Exclude from Display" and expanded "Rewrite results" and only checked "Use absolute link" for this field.
- Added field field_story_title, expanded "Rewrite results" and checked "Output this field as Link" with the Link path: [path] .

The view looks just fine with the field_story_title appearing as a link. View of PersonStory

However, clicking the link goes to the record in PersonStory instead of the record in Story. @skorzh suggested that I investigate replacement pattens in the Rewrite results, but I don't see any tokens which connect to the fields in Relationships in the View. Available Replacement Patterns

I’ve tried many different patterns and tokens and nothing has worked in details of [field_story_title]. I don't know what the replacement pattern should look like. Is it possible to join replacement patterns? How do I determine what the url should be?

My latest attempt is
[site:url:join:/]/[content-type:name]/[node:field-story-title:name] but it's not working, naturally.

Thanks.
(Entire post has been updated to reflect my current (lack of) progress)

2 Answers 2

1

You need to have the path field set to use the story relationship. http://cl.ly/372U1S1b2s3V

2
  • Excellent, so simple! Thanks @jphelan. There will be plenty of people grateful for this answer. Of course, it turns out now that's not really what I need to do. :( I need to resolve from the first view to another view, or something else, where I can reference the multiple content types. But that's for another question. I'll come back and post a link to it.
    – TdeV
    Commented Apr 21, 2016 at 18:32
  • Here's my evolved question @jphelan. drupal.stackexchange.com/questions/198809/…
    – TdeV
    Commented Apr 21, 2016 at 20:12
0
  1. Place content:path before the field X. Check "Exclude from Display". Expand "Rewrite results" and only check "Use absolute link" for this field.

Did you set properly relationship in this field?

  1. Field X - Rewrite results - Output this field as Link - Link path: [path] . Do NOT check "Use absolute path" here again.

You can try to write path by entity id token, without additional path field, so in Link path set something like Link path: node/[node_id] (see available tokens within Rewrite results)

2
  • I think the relationship is set properly, because the Story Title which displays in the view (Image 1 above) is only present in the original table Story (content type). I have set a relationship which is "A bridge to the content entity that is referenced via field_personstory_story_id". I don't know much about entity id token, so I'll look into that. Thanks.
    – TdeV
    Commented Apr 6, 2016 at 12:42
  • every token which I tried produced an error message. I can't find any tutorial information about token usage online, might you have some suggestions?
    – TdeV
    Commented Apr 13, 2016 at 18:46

Your Answer

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

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