When submitting a form, hook_nodeapi shows $node->taxonomy as something like this...

array
  1 => // 1 is the vid
    array
      177 => string '177' (length=3)

But when doing a node_save() it is like this...

array
  177 => 
    object(stdClass)[20]
      public 'tid' => string '177' (length=3)
      public 'vid' => string '1' (length=1)
      public 'name' => string 'Test' (length=4)
      ...

This completely screws up contrib modules like NAT when doing a node_save(). The problem is in node_form_submit just pushing form_values into the node object. Really we need to process these form values (kinda like CCK does) before getting back our internal representation of a node. I think the latter should be what is sent to hook_nodeapi. Sadly, this has to wait until D7 I suppose and may require some major refactoring so I don't have a patch yet. I'm thinking we should add a 'submit' op in taxonomy_nodeapi to change the form_values into the node object.

Any thoughts before I submit a patch?

Comments

RobRoy’s picture

Hmmm, but if we change it in node_submit(), any code that calls the API directly and does a $node = node_submit($node); before doing a node_save($node) will face the same problem. I'm not sure the best way to clean this up.

brianV’s picture

Status: Active » Closed (won't fix)

hook_nodeapi no longer exists in D7. Additionally, this isn't something that will be fixed in D6, since we don't do API changes within a major version...

Closing as 'won't fix'.