0

I have a content type "ABC" with the "telephone" field (field_phone_number) added to it, and I already have on my website around 1K nodes of this content type "ABC".

I want to display a table view on every node of type "ABC", displaying the title of all other nodes that have the same "telephone value" as the content type being viewed.

I have tried to use the EVA module but with no success.

This is what I have done so far:

  • Create an EVA View that show: "content" of type: "ABC".

  • Add all the field that I want to display.

  • EVA Settings:

    • Entity Type: Content

    • Bundles: ABC

    • Arguments: Check the "Use tokens from the entity the view is attached to" and add: "[node:field_phone_number]"

  • Add contextual filter: "Content ID" with provide default value: "Content ID from URL"

Results:

A table view displayed on every node with only the node itself is displayed inside the table !!!! (Not what I need)

For example:

If lets say i have 12 nodes that have the same phone number value: "123456789". What I am expecting to see is a view table displaying all the title of those 12 nodes every time I visit the page of each and every node of those 12 nodes.

Usually doing the above by using an entity reference field as the comon value between nodes is very easy, but the problem is that I do not have an entity reference field in commun between the nodes, rather I have the "Phone Number" field which is obviously it is not of type "entity reference".

Any help ?

Thank you,

1 Answer 1

1

You're on the right track with EVA. To list sibling nodes based on common taxonomy terms or entity reference fields you can just use Views configuration, but if you need to filter based on a different common field EVA is the way to go.

You did everything right except for the last step - you don't need Content ID Contextual filter, you're not comparing nodes, you're comparing Phone number fields! And the argument you set for EVA is the phone number, so that is the information you need to include there.

Add a Contextual filter for the phone field, you can configure it:
When the filter value is NOT available
Display contents of "No results found"
When the filter value IS available or a default is provided
Specify validation criteria
Numeric (or whatever is applicable in your case)
Hide view (if it doesn't validate)

That should list all the nodes that share that field, including the node you're currently viewing.

If you want to exclude the current node from that list you need to add another Contextual filter, this time it will be the Content ID one:
When the filter value is NOT available
Provide default value
Content ID from URL
When the filter value IS available or a default is provided
Specify validation criteria
Content
[ABC]
More
Exclude

That one will exlude the current node from that list.

2
  • thank you million times, you just saved me tons of working hours trying to figure it out on my own, especially with lack of tutorials on the internet about such use case ! You rock mate! Oct 20, 2018 at 4:39
  • 1
    I'm glad to help :)
    – prkos
    Oct 20, 2018 at 9:28

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.