How can i have a link field in a content type display a default text when the field is empty

175 Views Asked by At

How can i have a link field in a content type display a default text when the field is empty.

For now i have a field as a link - and the link is set to have a static title. This Works fine.

But i'd like to display a default title if the field is empty with no link (but still rendered as a link/button).

It's not a view - so i can't use "rewrite output if empty".

I'm a newbee to drupal - so please help

This shows what I've got so far: http://1fb72c32b5e90467b795f388746f7501b3ad8021.web9.temporaryurl.org/tmp/link2.PNG

When the link field is empty the button doesn't show. Instead of not showing when empty I'd like it to show someting like this as default: http://1fb72c32b5e90467b795f388746f7501b3ad8021.web9.temporaryurl.org/tmp/link3.PNG (the button "Bestil på tlf...")

1

There are 1 best solutions below

1
On

By simply using Link module, i don't think this is possible. But, follow below steps in your environment and i think you might achieve the goal:

  • Make custom template file for the page (i think, its product details page)

  • In that template file, check whether the link is empty or not

  • If link is not empty, show the link. If link is empty, show your custom HTML.