hook_nodeapi() - 如何订购其他字段

w00*_*00d 1 drupal drupal-6

我使用hook_nodeapi将我的自定义字段添加到一种节点

$node->content['my_new_field'] = array(
  '#value' => $content,
);
Run Code Online (Sandbox Code Playgroud)

但是,新字段仅出现在内容的末尾.反正我还有选择要展示的地方吗?例如:Title和Body之间.

出于某种原因,我将无法使用CCK,我想以编程方式进行.提前致谢

DrC*_*sos 6

有一种叫做的东西weight.如果您喜欢API文档中的代码,您将看到它应该如何工作.数字越大,数字越小.

所以你可以做点什么

$node->content['my_new_field'] = array(
   '#value' => $content,
   '#weight' => 5, //play with the values until you are happy with the output
 );
Run Code Online (Sandbox Code Playgroud)