English 中文(简体)
在形式提交时,我如何自动确定闭路参照地的价值。
原标题:How do I set the value for a CCK Node-reference field automatically when create form submits

我有一个内容类型(A),指不同内容类型(B)的单一标语。 参考(B)可在方案上利用信息确定这一新的术语。 每个用户只能生成参考内容类型(B)的单一标注,因此,这种单项标注总是从用户生成的B类内容的标注中参考。

由于提及节点始终为人所知,我并不希望用户必须进入参考值,因此我想将其放在幕后。 我已经找到了这方面的一些线索,但似乎没有为我明确或实际工作。

任何帮助都将受到高度赞赏。

注:第6博士

最佳回答

你可以尝试:

function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   switch ($op) {
      case  insert :
         if ($node->type ==  type_a ) {
            $node->field_of_reference[0][ nid ] =  node reference value ;
            node_save($node);
         } 
         break;
   }
}

这应当为节点增加价值,并在节点建立后予以节省。

http://api.drupal.org/api/Function/hook_nodeapi

注:你需要建立一个模块来推动这项工作。 你们也可以尝试《规则》模块,但我不相信,它将在没有习惯规则的情况下做你要求的事情。 但我知道上述方法将发挥作用。

问题回答

如果没有任何方案拟定——使用“规则”模块、活动——更新、行动——将领域设定为一定价值。





相关问题
Drupal Multi-language: Simple strings not translated

I m adding additional languages to a Drupal site that I m building. Getting the translation of content working is fairly easy using the Internationalisation module. Yet, simple things such as date ...

Setting up a WYSIWYG editor for Drupal site users [closed]

Looking through the Drupal contrib modules, and after a few Google searches, it becomes evident that there are any number of choices and combos available to set up a WYSIWYG editor in Drupal. I m ...

Change size of user/password login box

I don t know how to change the size of the login username/password boxes on the drupal site that I m trying to build. I m stumbling through the theming, and don t know where to find the file that ...

How does Drupal provide an edit/review/publish model?

How does Drupal support a means to update and review a website before it is published? Does it only allow you to preview a page at a time before you publish it or is there a way to create a site ...

Term for rotating header

I m looking for terminology that describes this behavior: The header of a web-page contains a different image every time you visit it. Update: It is not an advertisement, but images related to the ...

Has anyone checked out Drupal 7? [closed]

Has anyone checked out a copy of Drupal 7 yet? What do people think? I m pretty excited about the PDO and all of the designers I work with a very excited about the new admin interface/structure. Do ...

热门标签