Closed (duplicate)
Project:
Entity reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Aug 2011 at 12:32 UTC
Updated:
21 Aug 2012 at 08:45 UTC
Jump to comment: Most recent file
Comments
Comment #1
damien tournoud commentedThanks for reporting this. Yes, I would like to see this happen. Should be relatively easy (look at the existing relationships in CTools for inspiration). Patches welcome!
Comment #2
BenK commentedSubscribing
Comment #3
itangalo commentedI can only agree with Damien and others, this would be great. :-)
Comment #4
Shadlington commentedSubbing
Comment #5
henrijs.seso commentedThis should not be hard at all. What kind of entity reference support we need? Normal and reverse? Or more kinds? Some interface mockups would be helpful.
Comment #6
itangalo commented@mansspams: Just normal would be fine, if reverse are included it would be awesome. For multiple-value fields, the normal approach (so far) has been to pick the first value – so I guess that would be good in this case as well.
Comment #7
Taxoman commented+1
Comment #8
das-peter commentedI just looked into
ctools/plugins/relationships/entity_from_field.incand the attached patch is basically just a copy&paste of it - with some small modifications.First tests look promising - would be great if someone else could give this a try / review.
Comment #9
damien tournoud commentedThanks das-peter! This looks great.
Any reason why those don't use
field_info_field()andfield_info_instance()? The read versions are uncached and kind of internal to the Field API.Comment #10
das-peter commentedThe idea behind using
field_read_fields()insteadfield_info_fields()was to be able to fetch all fields with the field typeentityreference.With
field_info_fields()we need to iterate over all existing fields.And to use
field_info_field()we need to know the field name - but how could we without usingfield_read_fields()/field_info_fields()?But I definitely wasn't aware that
field_read_fields()is uncached - looks like this comes down to a simple question of performance. If iterating over all existing fields is faster than thefield_read_fields()we should change the code.Or is there even another way to get the all fields of a specified field type?
Comment #11
amateescu commentedJust wanted to let you know that I posted a patch for ctools that implements this functionality: #1315046: Add tools to help find all field definitions of a specified field type.. Earl said on IRC that he's ok with it, but I guess an extra review can't hurt :)
Comment #12
das-peter commentedIndeed that would be a handy function.
However, since we're mainly talking about performance here (if I didn't miss something) I'd go directly with an own loop ;)
Comment #13
amitaibuOh my, how did I miss this issue :/ -- #1340748: Add CTools relationship
Comment #14
damien tournoud commentedCan anyone clarify the relationship between this and #1340748: Add CTools relationship?
Comment #15
damien tournoud commentedOk, duplicating this in favor of #1340748: Add CTools relationship.
Comment #16
sirviejo commented#8: entityreference-add-ctools-relationships-1258502-8.patch queued for re-testing.
Comment #18
amateescu commentedWtf?