Compatibility issues with CCK fieldgroup.
| Project: | Nodereferrer Create |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
I tried to use nodereferrer_create together with fieldgroup from CCK but ran into problems.
Observed effects:
With inline controls enabled, any nodereference or noderefferer field in a fieldgroup is moved to the bottom of the page (outside the fieldgroup), along with the inlined controls.
When creating/selecting a new referrer node, the default value of the corresponding field is missing.
Cause:
Fieldgroup moves the grouped fields so they are no longer located directly under node->content->field_name. Instead they are now at node->content->group_name->field_name.
This applies both when viewing and editing a page with grouped fields.
When inline controls are enabled, nodereferrer_create.module operates on the fields before fieldgroup.module groups them, and because nodereferrer_create.module also alters the location of the actual field, fieldgroup.module cannot "find" and group nodereferrer or nodereference fields. (Fieldgroup has a weight of 9 to be able to operate after all other field-altering modules)
Proposed solution:
I'm attaching a patch which works by checking if the relevant field exists in node->content. If not, and fieldgroup.module is active, it gets the group name for the field and looks under node->content->group_name instead, does its thing and inserts the wrapped field and controls at the found location. It does the same thing for the node create/edit form when inserting the default value.
NOTE: I've also set nodereferrer_create.module's weight to 10 to allow fieldgroup.module to put fields in their correct locations first, but this is not included in the patch yet! This could of course be done in an .install file, while also making sure that previous installations are updated accordingly. I've NOT tested this with the feature allowing one to sync other fields when creating new content! But I think the same approach could be used there.
| Attachment | Size |
|---|---|
| noderef_create_fieldgroup.patch | 3.5 KB |
