I have another field that I would like to link to the page instead of the title field. I see that you can only say "link: yes" if you are working with the Title field. How do I make another field that can link to the node content? Thank you.

Kelly

Comments

kzeeh created an issue. See original summary.

praveenneelu’s picture

Hi kzeeh,

Use Display Suite Code Field to get the Current node title as link (by using [node:title] related token) in it. Please view this below link, you got an overview about DS fields,
https://www.drupal.org/node/1795314

kzeeh’s picture

I read all that. I have ANOTHER field, not title, in my content type. I want to use THAT field as a LINK to view the page. How do I make a field other than title to be a link to the node?

Can you tell me exactly what I'd put as the code for a code field? Thank you.

praveenneelu’s picture

Hi @kzeeh. This is pseudo code. I wrote the logic only. In DS Code field, use function call instead of directly use if-else condition for better performance.

<?php

  $node = node_load('[node:nid]');
  $node_title = '[node:title]';
  if(is_object($node)) {
  	if($node->type == "YOUR_ENTITYTYPE_MACHINE_NAME") {
  		$nid = $node->nid;
  		$node_id = "node/$node_id";
  			if(!empty($node_id)) {
  				$node_title_link = l("$node_title","$node");
  				print $node_title_link;
  			}
  		}
  	}
praveenneelu’s picture

Status: Active » Needs review
praveenneelu’s picture

Status: Needs review » Reviewed & tested by the community