0

I have a text field that I use to store an entity title. It is not the "native" entity title, but just a field named field_title.

Now I want to display this text field as a link to the entity (e.g. product/123). (I am working with Display Suite here, but the question is not limited to that)

I know I could simply create a custom formatter for this. But isn't there an easier way? I think I even did this once, just can't remember.

I also found the Field Value Link Formatter module , but this doesn't seem to be it.

EDIT: There are some known solutions like DS custom fields, or Custom Formatters, or hook_field_formatter_info() in a custom module, or node template override, or field template override, or the awesome hook_ds_field_theme_functions_info().

However: This seems such a recurring use case that I consider to write a new (reusable) module and publish it. So, I am looking for a solution so easy that it invalidates the desire to write a new module :) I think I saw something like this once, just can't remember.

1

you could do this with a Display Suite custom field and use the tokens to build the link.

I would do it like that if I wouldn't like to write a custom template. Or, as already mentioned, create a template for that node. Due to the fact that you don't use the native title, you will have it available in the node template and you can change the markup there.

  • Yes, the DS custom fields.. This does work, but I am still looking for something easier. This is such a recurring case. Still +1. – donquixote Jul 3 '14 at 12:48

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.