Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In CCK 3.x there is support for Multigroups. If you keep the NodeReference field out of the multigroup the "View" formatter works fine, but if you put the field inside a multigroup you get nothing (supposing NULL value).
Comment | File | Size | Author |
---|---|---|---|
#12 | nodereference_views-HEAD_content_multigroup_compat.patch | 2.46 KB | dboulet |
Comments
Comment #1
joachim CreditAttribution: joachim commentedWhat's CCK3? I don't see it on the CCK project page.
Comment #2
looplog CreditAttribution: looplog commentedCCK 3.x is a branch for new features of CCK. You'll find it in the releases page. I'm having the same problem, though I did get a more specific error message that may help. If I choose view for the nodereference field in a multigroup and format the subgroup as a table, then I get the null result. If I just output the field in an unstyled subgroup, I get the following error:
warning: Illegal offset type in isset or empty in /srv/www/htdocs/61309/includes/theme.inc on line 590.
Comment #3
joachim CreditAttribution: joachim commentedThe problem is going to be earlier than that: you'd have to have a look at that comes into theme_nodereference_views_formatter_views($element).
I'm afraid I'm busy with other projects, so I don't have time to work on this. Furthermore, supporting a dev release is chasing a moving target, so I don't think it's really worth it.
Though if you're able to look into it and provide a patch that doesn't break 6-2 compatibility, I'll commit it.
Comment #4
tomsm CreditAttribution: tomsm commentedI also use CCK3 multigroup and "Node reference views" offers the extra functionality I am looking for.
So I hope that this feature will be added soon...
Comment #5
michellezeedru CreditAttribution: michellezeedru commentedSubscribing... also using CCK3 multigroup and would like to use node reference views in that context. Thanks!
Comment #6
BenK CreditAttribution: BenK commented+1 for this feature... CCK 6.x-3.x-dev with multigroups is actually quite stable. More than 5200 installations exist according to the usage page and the branch maintainer is very careful with it because he knows that a lot of people use this dev branch on production sites.
Comment #7
joachim CreditAttribution: joachim commentedI don't have the time to work on new features for this module, I'm afraid.
If you can work amongst yourselves and make and test a patch, I'll commit it and make a release :)
Comment #8
elektrorl CreditAttribution: elektrorl commentedsubscribing
Comment #9
t0b1 CreditAttribution: t0b1 commentedsubscribe
Comment #10
drupalok CreditAttribution: drupalok commented+1 for this feature! thanks for the great work!
Comment #11
Alexander Allen CreditAttribution: Alexander Allen commentedSubscribe
Comment #12
dboulet CreditAttribution: dboulet commentedThe problem here comes from the way that the formatter handles multiple values. The modules is designed to take all the nids from the node reference field and send them to the view as a single argument. Multigroup fields can't work like that—every item must be formatted seperately, so that it can be grouped with the items of other fields.
One solution I've found is to add a second formatter which renders only one item at a time. This is probably awful for performance, but it will work for multigroups.
Comment #13
looplog CreditAttribution: looplog commentedTested the above patch and it seems to work.
Comment #14
joachim CreditAttribution: joachim commentedCCK 3 still doesn't have even a dev release...
Comment #15
dboulet CreditAttribution: dboulet commentedSure it does, it's just not displayed on the project page. And according to usage statistics, it's currently being employed on roughly 13,000 sites.
Comment #16
joachim CreditAttribution: joachim commentedWhy does it not show on the project page then?
The problem I have here as maintainer is that between CCK 2 and 3 and View 2 and 3 there are 4 possible combinations of APIs to support. I'm not going to do all 4, obviously -- so the sane choice is to only do the recommended releases. When things have dev releases or alphas I'll consider how to handle branching this module in a meaningful way. Until then, this patch is postponed, sorry.
Comment #17
dboulet CreditAttribution: dboulet commentedGood point joachim, I completely understand. Not sure why CCK 3 isn't shown on the project page, but I'm guessing that development lagged a little while the maintainers were busy working on Drupal 7.
In defense of my patch, the new formatter is only added in presence of the 'Content Multigroup' module, so NRV will be unaffected without it. Then again, it's quite easy to implement my changes into a custom module.
Thanks for the feedback!
Comment #18
joachim CreditAttribution: joachim commented> In defense of my patch, the new formatter is only added in presence of the 'Content Multigroup' module, so NRV will be unaffected without it.
Ah! That's clever :)
Yes, in that case it should be fine to go in. Sorry; pushed for time like all maintainers and hadn't actually looked at the patch... Will deal with it when I have a spare moment; in the meantime one or two further reviews would be great.
Comment #19
joachim CreditAttribution: joachim commentedOkay, now I actually look at this I see what it's doing.
Is there any information contained in $element that would indicate whether the current field is part of a multigroup? If so, then we could do everything in the one formatter, which would improve performance a little bit as we'd only call views_get_view() once.
Comment #20
dboulet CreditAttribution: dboulet commentedThe problem is that, from what I can gather, fields in multigroups aren't compatible with formatters that have
'multiple values' => CONTENT_HANDLE_MODULE,
. The formatter function simply doesn't get called at all.Comment #21
joachim CreditAttribution: joachim commentedAh, right.
Committed, with a minor tweak (no point in storing $nid if we only use if once).
#581110 by dboulet: Added support for CCK 3.x multigroups.
Thanks! :D
Don't think there's anything else in the issue queue that's going to get committed soon, so going to roll a release with this now.