2

This is the same question of this link:

Removing [nid:n] in nodereference autocomplete

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]).

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

Anybody can help me?

2 Answers 2

0

When viewing the node, it is the theming function for the field that determines what is displayed, so you need to overwrite it, if you want to change the output.

The value when you edit the node, is determined by the #default_value property, so you need to change in your hook_form_alter()

0
0

Thanks for the answer.

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

I change the code of this file:

drupal\modules\cck\cck\modules\nodereference.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.

Regards!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.