I checked 'distinct' in my view configuration in Query settings under the 'advanced' fieldset.

So say when I have have three entities connected to one node, there would be three rows in my view of the same node of course one for each entity.

Fields settings

  • Content: Hour ('event')
  • Content: Title ('event')
  • Content: Body ('event')
  • (Content entity referenced from field_event_performer) Content: Title
  • (Content entity referenced from field_event_performer) Content: Body
  • (Content entity referenced from field_event_performer) Content: Foto
  • Content: Title ('event')
  • (Content entity referenced from field_event_performer) Content: Performer

Some fields I've given a class in order to hide them using jQuery and show them in a modal frame when clicked on. That's why fields are shown double. First I thought the problem was be because of the weird field settings. But the nodes that show only one time have the same field settings, only do they have more performers referenced.

I have 4 filter criteria in total:

  • Content: Published (Yes)

  • Content: Type (= Event)

  • Content: Evenement type (= Presentatie) | Settings (taxonomy)
  • Content: Locatie (= Kraakhuis) | (taxonomy)

Having done searches I noticed that everyone who had this problem, only needed 1 field from the referenced entity and could use the aggregation funtion as found under advanced. This works quite fine here as well if I only needed 1 field.

But in my case, when output into a modal frame, one entire row should look like this:

  • Node123 title
  • Node123 body
  • referenced entity 1 title
  • referenced entity 1 body
  • referenced entity 1 picture
  • referenced entity 2 title
  • referenced entity 2 body
  • referenced entity 2 picture
  • referenced entity 3 title
  • referenced entity 3 body
  • referenced entity 3 picture
  • What are you using for sort criteria in your view? If you're trying to sort on a taxonomy term (for example) and the node has three terms associated with it, views join criteria often won't be sufficient to remove duplicate entries, even with the distinct flag checked.
    – schnippy
    Oct 16, 2012 at 21:49
  • So as you can see I added details about the view. Not entirely straightforward. Would it still make sense to have taxonomy be at the root of this problem? Now that we know that views outputs an equal amount of duplicate nodes as there are values in the referenced entity field of 'event'?
    – Immers
    Oct 17, 2012 at 7:18

1 Answer 1


What helped is going custom code. Instead of relying on the fields that would have come out of the Views query, I grabbed the nid of my referenced field of my 'event' content type and loaded the rest of the fields via node_load();. All of this happening in a tpl file views-view-fields--viewnale--block.tpl.php

I used the row object and made a loop that went over the multiple valued referenced entity.

    <?php foreach($row->field_field_evenement_performer_1 as $key => $whatever): ?>
    <?php $performer = node_load($row->field_field_evenement_performer_1[$key]['raw']['target_id']);

    $title = $performer->title;
    $picture = $performer->field_performer_foto['und'][0]['uri'];   
    $bio = $performer->body['und'][0]['value'];  

    print '<div class=\'forModal\'><h3>' . $title . '</h3></div>';
    print '<div class=\'forModal\'><img src="' . $picture . '"/></div>';
    print '<div class=\'forModal\'>' . $bio . '</div>'; ?>

<?php endforeach ?>

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.