I need to create a table style view that has separate columns for each field of each instance (delta) of a field collection. I was able to implement this by copying from the references module. See http://drupalcode.org/project/references.git/blob/refs/heads/7.x-2.x:/vi... for an example.

I haven't written a patch because I couldn't figure out how to get views to load the file for my new handler, so I just stuck it directly in the existing field_collection.views.inc file. I might try again later and submit a patch.

My use case is this: I am setting up a sports league management system and I have a content type of match. I have a field collection of team and the team has team name, score and a checkbox for if the team forfeited or not. The field collection has a max delta of 2 so basically I would have a relationship for delta 1 called "home team" and a relationship for delta 2 called "away team".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Murz’s picture

subscribe

mstrelan’s picture

Dammit I wish I wrote a patch because now I can't figure out how to get this to work.

mstrelan’s picture

Status: Active » Needs review
FileSize
2.78 KB

Here we go. Might need a cache flush or two, or maybe even forcing views to flush it's cache too.

Status: Needs review » Needs work

The last submitted patch, 1208346-field_collection_views_relation_delta.patch, failed testing.

13rac1’s picture

Assigned: Unassigned » 13rac1
Status: Needs work » Needs review
FileSize
3.38 KB

This issue was created before mine, #1332452: Add result Delta to Views Relationship Handler. I set mine issue to Duplicate.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks pretty fine

Zeotyn’s picture

works wonderfull!

p4trizio’s picture

Works

tim.plunkett’s picture

Assigned: 13rac1 » Unassigned
Status: Reviewed & tested by the community » Fixed
13rac1’s picture

Cool thanks! I wish --author was used more often on d.o.

tim.plunkett’s picture

Git doesn't understand multiple authors, unfortunately. But I do try to use it when there is a clear single author.

charlie-s’s picture

I patched up -- does this provide sorting by delta? I can't seem to get that working.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Spleshka’s picture

@mstrelan,
Thank you so much! I saved a lot of time for coding same relationship handler for Views :)