I am in need of a custom function that will format a node reference ID that groups a list of DS nodes (I am sorting successfully using this reference node.) I need to be able to take the node ID, which is what is currently being pulled, and pull the title of the node being referenced instead.

Is this possible, and if so, as I'm not a programmer, is there a simple function that can accomplish this task?

Thanks.

CommentFileSizeAuthor
dsgdhelp.jpg68.49 KBCrashNet

Comments

swentel’s picture

Status: Active » Needs review

Put in 'print_reference_title' as the function and declare this function in a module. (or maybe in template.php, I think that one should be picked up as well).

function print_reference_title($nid, $object) {
  $title = db_query("SELECT title FROM {node} WHERE nid = :nid", array(':nid' => $nid))->fetchField();
  return check_plain($title);
}

Completely untested, but I think it should work.

swentel’s picture

Status: Needs review » Closed (fixed)

Marking as fixed

CrashNet’s picture

Swentel...thanks for this. I'm apologize for not responding sooner. Crazy busy as always. I'll test and confirm. Again, thank you!

jferrervalls’s picture

Hello,
I've got the same problem and I can't find any help on this.
Did you manage to do it?
I don't know in what file I should declare the function.

Thanks

rajab natshah’s picture

Thanks.
we need to add the function name only with no arguments
as print_reference_title

mahipal46’s picture

fix issue provide function name in textfield without argument and declare function in your module file.module file will be anyone.