I have several situations where I want to be able to pull in fields from other nodes via CCK. I've written a patch to nodereference.module which allows users to select fields to display on a per-content type basis. I'm not sure if this is the best approach, but it's working for my needs. Any suggestions would be appreciated :).
One question I had was how to properly add the fields once they have been found. I'm currently doing the output in nodereference_field_formatter, but I think that manually inserting the <br /> isn't the best method.
Thoughts I've had for features which I'd consider doing if this was going to be merged in:
- Allowing shared fields to be only shown within specific referenced content types.
- Selecting the fields on a per-node and not a per-content-type basis. This brings up issues of consistency though.
- Somehow actually storing the referenced fields within the node, so they can be rendered in a simpler manner.
--Andrew
| Comment | File | Size | Author |
|---|---|---|---|
| field_display.patch | 2.5 KB | deviantintegral |
Comments
Comment #1
moshe weitzman commentedthis is pretty interesting. in addition to render time, i've needed the referenced fields at node_load time. for example, they might be needed in a computed_field. subscribe
Comment #2
mshaver commentedI'm in need of this same functionality, but it looks like the original patch was to an earlier version? In my 4.7 template.php file I had modified the "theme_nodereference" function to get this. With this gone in 5.x versions, I'm not sure where to start. I could modify the teaser to display the fields that I would like, but that changes the teaser everywhere, which I'd rather not do. I'm more interested in how the nodereference displays within another node or in a view.
Any ideas?
Comment #3
moshe weitzman commentedthis is going to be made possible by Views 2.
Comment #4
deviantintegral commentedFYI this patch doesn't apply cleanly against 1.6 (It's for 1.5). My client changed their mind and they don't need the feature anymore, so I haven't bothered to update this. If this functionality is going to be in Views 2 then that's all I need to hear :).
I'm marking this as closed.
--Andrew