Closed (fixed)
Project:
References
Version:
7.x-2.x-dev
Component:
Code: node_reference
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2011 at 17:26 UTC
Updated:
29 Apr 2011 at 23:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
fgmDo you mean you migrated an existing D6 site with CCK/node_reference to D7 with References ? This has only had preliminary work yet.
Comment #2
loganfsmyth commentedYeah, I've been testing it out on a site of ours that we're considering upgrading. We're aware it's kind of iffy, but I just wanted to post this since it seems to fix the issue. I don't doubt there is more to be done.
Comment #3
yched commentedThie code in node_reference_content_migrate_instance_alter() aims to massage the $instance prepared by content_migrate, only if its an instance of a 'node_refererence' field.
We want to be switching on the field type, not on the widget type module (I guess 99% existing D6 noderef fields out there use one of the widgets defined in noderef.module, but there are contrib modules providing alternate noderef widgets)
So I'd say something more like the attached patch ?
What is confusing is that the hook example and most implementations within content_migrate itself currently build their logic on $instance_value['widget']['module'] like the patch in the OP.
[edit: opened #1039466: What to do with custom formatters and widgets? ]
Comment #4
yched commentedAttached patch should take care of updating formatters as well (the 'full' and 'teaser' formatters have been merged into a formatter setting)
Comment #5
lliss commentedSo while this one does seem to solve the problem of the missing references it does not allow the CCK Migration to actually recognize the node references as fields that can be migrated. If we alter the value used in the switch statement we will actually get noticed by CCK migration but there still seems to be trouble with actually pulling in the values when we run the migration. This patch at least solves the former issue in both the node_ and user_references migration.
Comment #6
karens commentedI just committed a simple fix that gets rid of the notices (the arguments had changed for these functions). I did not see or do anything yet with the patch to update formatters, or yched's note about switching on type instead of module.
I will see if I can tell what else needs to be done.
Comment #7
karens commentedI got all this much committed as a start. I don't have time right now to figure out what else is needed. If someone does, please post an additional patch.
Comment #8
yched commentedThanks Karen - while you're in there, there seems to be an indentation issue around the '//massage the widget' line in the committed code :-)
http://drupalcode.org/viewvc/drupal/contributions/modules/references/nod...
(sorry, I'm not where I can easily commit a quick fix)
Comment #9
yched commentedFixed indentation, + committed the code to the 7.x-2.x branch instead of HEAD ;-).
I'm probably going to remove all the code from HEAD for now, just to avoid further confusion - unless someone beats me to it.
Comment #10
yched commented"I'm probably going to remove all the code from HEAD for now, just to avoid further confusion" : Done.
Comment #11
danielb commentedIs the variable name spelled "$dislplay" on purpose?
I found this issue because I have written a module that tries to determine whether a field is a User reference field and it does so by checking
$field['display']['default']['module'] == 'user_reference'where $field is an array value of the bundle and the bundles come fromfield_info_instance('node'), which seems to work fine for me, but other users are reporting that 'module' is an undefined index. #1069994: Undefined index: module in nodeaccess_userreference_node_access_records() (line 138Comment #12
yched commentedThe "$dislplay" typo has been fixed since then, it seems.
@danielb : I'm not sure what's the status of #1069994: Undefined index: module in nodeaccess_userreference_node_access_records() (line 138, but it does seem strange to check the module implementing the formatter that happens to be used on a given view mode to determine whether a field is a User reference field. Why not just $field['type'] == 'user_reference' ?
As for this specific issue, I think we can now mark this closed.