I realized while doing a batch-import of users that life would be much, much easier if the $changes array were passed to the handler along with the $account / $node / etc. - the way that hook_user() passes both $account and $edit.
This is because for some things, like Locations, the information is stored several levels deep in the array. Neither PHP's array_merge() or array_merge_recursive() handle things the way salesforce needs. And while we could write custom merge code rather than use one of those functions, it's still more flexible in the long-run to pass both variables the way hook_user does.
The question is: should the $changes array be passed as the second parameter, in keeping with how Drupal generally does things; or as the last parameter, so it has least impact on existing salesforce add-on modules (do many exist?).
I lean towards second parameter, because the API for import handlers has already changed for alpha1 (by adding two extra parameters, one of which is in the middle), and it's closer to how everything else works in Drupal.
Any preferences?
Comments
Comment #1
aaronbaumanThe first issue that jumps out at me is that hook_user uses a $changes ($edit) parameter and hook_nodeapi does not.
Can you provide a concrete example or a patch of what you're proposing?
Comment #2
bibeksahu commentedGood point.
And actually, the more I think about it, the more I realize that Drupal does not use handlers anywhere - it uses hooks. So to truly go the Drupal way, we should use Hooks instead.
(Perhaps with a backwards-compatible Import/Export Handler hook-implementation. I'd hate to think of how many tiny custom handlers have been created against this module over the last couple of years...)
And although D6 hooks and D7 hooks are different, and we need to focus on D6... turning in a D7-looking way would probably be handy.
Patch in a while. No guarantees on time, but I'll shoot for sooner rather than later.
Comment #3
EvanDonovan commentedSubscribing - wondering what the best direction for this would be. D6 & D7 are not much different in terms of hooks (other than the names of them).
Comment #4
kostajh commentedNot getting added to 6.x-2.x.