2

If I have field label as Links and type is a node reference link to Page Title. And its displayed like this:

Links: Page Title

How to make the label is the link to the node without showing Page Title like this:

Links

2

I propose to do so (if you have a module Display Suite):

Go to ../admin/structure/ds/view_modes

Add a view mode: name is "label" and entities: "Node"

Then go to ../admin/structure/types/manage/your-content-type/display and on "Custom display settings" tab check the "Label" mode

Now go to ../admin/structure/types/manage/your-content-type/display/label select "Reset" (ds_reset) Layout, then make visible only the "Read more" and customise it: "Link text" - "See details" for example...

Then on referenced content type select "Rendered entity", and "View mode" - "Label"

Done!

2
  • 1
    I haven't give Display Suite much of credit, as I blindly prefer sticking to templates files, but this helping! Thanks – Kareem Aug 23 '15 at 15:53
  • 2
    In our projects, I always use this module, try it for yourself, it is extremely flexible and provides many opportunities. Why are only "custom layouts", "block as field" or other "extra" features. – NikGleb Aug 23 '15 at 18:43
1

You'll need to alter how it is rendered using a field template file (fieldname.tpl.php).

2
  • 1
    Thanks for the tip, I've tried this <a href="<?php print $item ?>"><?php print $label ?></a> but that is seems wrong, any idea? – Kareem Jan 24 '15 at 11:09
  • 2
    That's a reasonable start, but print $item won't give you the link. Install the Devel module and start by using dpm($item) so it shows you what's in the variable. – Darvanen Jan 26 '15 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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