I have a Views on which I display an event calendar. Events get created through a separeate content type which contains a checkmark "Link to page" which will (if checked) display a "view" link in the table which links to the created content. Now i have added another field in the content type of type text "External link {will link to current page if left empty)" which should override the linkage to the current page and render the "view" link to link to the url entered in "External link" field. How would I do this? Please advise! Thanks!

edit 1

No, I currently hacve a checkbox that creates a link whichj links to the current content but nothing that woul consider the newly added field "External link (will link to current page if left empty)"... How do I can I do this?

  • 1
    Are you saying that you already have an added field that links to the content if left empty, or an external link when filled out? If so, then all you need to do is add that field to your view and remove any other fields or elements linking to the content in the view.
    – Geoff
    Jun 22, 2014 at 23:04
  • @Geoff no, please see edit 1 above
    – stdcerr
    Jun 23, 2014 at 2:54

3 Answers 3


In theory, you should be able to use the link module to create a link field within your content, and use a default value pointing to the newly created content - this may require some customization of the code - it accepts tokens, but I don't know if the node id has been assigned at that point or not.

Assuming it works, one way or another, you would then simply include that field in the view, which should display as a link - if it is used, it would link to the external link, otherwise to the content (as default value).

If that isn't reasonable, you could try to use the same field (without modifications or default value) in the view, and create a NO RESULTS BEHAVIOUR that rewrites it to the content - meaning if there is no value in the field, it would link to the content, or use the value of the field (external link) if present.


You can try using the Computed Field Module

This way you can perform your checks and store the value in the second field. Then you can just display that field in the views.

module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code. You may draw on anything available to Drupal


just needed to REWRITE RESULTS and enter something like <a href="[field_external_link]">view</a> to get it rendered correctly. Beauty! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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