如何在 NodeReference 字段中删除节点 ID [nid:n] [英] How remove node ID [nid:n] in NodeReference fields

查看:27
本文介绍了如何在 NodeReference 字段中删除节点 ID [nid:n]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是这个链接的相同问题:

This is the same question of this link:

删除节点引用自动完成中的 [nid:n]

根据第一个答案(Grayside),我创建了自己的模块并激活.然后我创建了一个新内容,我在 nodereference 字段中查找并最终选择它 -> 它有效(没有出现 [nid:n]).

According with the first answer (Grayside) I've created my own module and activated. Then I create a new content, I look sth up in the nodereference field and finally select it -> it works (Doesn't appear the [nid:n]).

但是,当我查看/预览或保存或编辑内容时,[nid:n] 再次出现.

But, when I view/preview or save or edit the content, the [nid:n] appears again.

有人可以帮我吗?

推荐答案

感谢您的回答.

我找到了解决方案.(至少在我的情况下)

I've found the solution. (At least in my case)

我更改了这个文件的代码:

I change the code of this file:

drupalmodulescckcckmodules odereference.module

drupalmodulescckcckmodules odereference.module

function nodereference_autocomplete_value($element, $edit = FALSE)
{
  ...
  // $value .= ' [nid:'. $nid .']';    --> Comment this line
  return array($field_key => $value);
}

效果很好!在任何情况下都不出现:不在从列表中选择,也不在保存、编辑等时出现.

It works very well! Doesn't appear in any case: Not in selected from the list, nor when save, edit, etc.

问候!

这篇关于如何在 NodeReference 字段中删除节点 ID [nid:n]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆