结合两个节点形式..这可能吗?

时间:2011-04-10 16:33:47

标签: forms drupal-6 cck

我正在使用drupal 6并且我获得了内容类型1的node_form,我想在第一个内部更改其他内容类型节点表单,这可能吗?

1 个答案:

答案 0 :(得分:0)

如果要将值从第一种形式添加到第二种形式,可以使用hook_nodeapi()来更改第二种内容类型节点。

function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
  switch($op){
    case 'presave':
      if($node->type == MY_NODE_TYPE){
        // $other_node = node_load($other_nid);
        // or
        // $other_node = new stdClass();
        // $other_node->title = ...
        // ...
        // some code to altering other node
        // $other_node = node_submit($other_node);
        // node_save($other_node);
      }
      break;
  }
}