I would like to use the nodereference module to show related links to a node. But I don't want to use the related nodes title for creation of the links. I would like to optionally define the title of the link, as a kind of override.

Would it be possible to add a optional field for overriding the link title. It could be as an optional field setting.

Comments

yched’s picture

Category: feature » support

Customizing the display to your own special needs is precisely what theming is here for - the module itself can't provide all possible options here.

Define a special template for your field (see theme/README.txt in your cck folder),
and inside do something like

<?php
foreach ($items as $item) {
  $ref_node = node_load($item['nid']);
  $my_text = $ref_node->the_thing_you_want; ?>
      <div class="field-item">print l($my_text, 'node/'.$ref_node->nid);</div>
<?php } ?>

Turning this into a support request.

yched’s picture

I forgot the <?php ... ?> tags around the print l(...) part.
You'll have corrected yourself :-)

NaX’s picture

I looked at doing it this way, but the problem I have is that title of the links can be specific to that link and is not part of the $node var. I have sort of hacked this module to add this feature but I just need to finish it off. I will post a patch later for review.

Thanks.

yched’s picture

OK, I think I get it.
You want to be able to pick a node to refer to AND give a custom "alias" to be used as the text for the link instead of the node title.
Why not - This is not going to be possible for the select / multiple widget, though.

drewish’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

i'd love for node reference to allow an additional field describing the node relation...

summit’s picture

Subscribing, still interested in this for D5.
greetings,
Martijn

Manonline’s picture

Hi all... there is a way to override the title display of a nodereference in a view result?

I tried to rewrite the output of the field as a link in the view, but when the content's nodereference field is empty, the link still appearing.

thanks and sorry for my english.

karens’s picture

Status: Active » Closed (won't fix)

Closing old issues. None of us is using the D5 version any more, so hard to provide any support. Sorry.