When referencing fieldable file entities, the selected items are rendered incorrectly. I don't know if this is an issue with the File Entity module or Entity Reference View Widget. The first selected item renders as 4 draggable rows (one "remove" checkbox, two empty rows and one showing the rendered entity). Additional selected items show up only as "remove" checkboxes.

Structure > File types > Image > Manage File Display is set to "Image." Changing this doesn't seem to help.

Using all latest dev versions of Views, Entity API, File Entity, Entity Reference and Entity Reference View Widget

Also, I've tried this with the latest version of ERVW from the git repository, but the the problem still exists.

See attached screenshot and exported view.

Comments

seanr’s picture

Precisely the same issue here. jonraedeke, thanks for narrowing it down to fieldable - that gives me some good debugging ideas, which I will attempt tomorrow.

seanr’s picture

Category: feature » bug

Already found the fix. Issue is on line 298 f the module file. Why are we doing this there?:

$entity_view = entity_view($entity_type, $selected_entities, 'entityreference_view_widget');
$entity_view = reset($entity_view);

The second line of that is screwing up the $entity_view array so it contains only one full entity rather than the list of entities. Comment that line out and the display works perfectly.

jonraedeke’s picture

Status: Active » Needs review
StatusFileSize
new715 bytes

Great work seanr! Worked for me. Here's a patch. (It's my first Drupal patch, so let me know if I did anything wrong.)

seanr’s picture

Patch looks good to me. Don't want to mark this RTBC yet though until someone can test with a file field without extra fields.

bojanz’s picture

Issue summary: View changes
Status: Needs review » Needs work

The reset is definitely needed for some entity types so the proposed fix is wrong.

bojanz’s picture

Status: Needs work » Closed (won't fix)

Since there is no working patch, and the 1.x branch is no longer maintained, marking this as "won't fix".
Please use the 2.x branch instead. It should not have the described problem. Thank you for your patience.