I am using Drupal 7 and have created a custom content type and a view that displays those content types. What I want to do is override the url to the node in the teaser view. My specific use case is this:
I have a support view that displays support content types. When I view that page, I see the teasers for the support content types I have created: Safety, FAQ, Ticketing. Safety and FAQ link to their nodes as expected. What I am trying to accomplish, is have the teaser and image for ticketing there, but have it link to my external ticketing portal. Essentially, I would like to have a checkbox when creating content of this type that allows me to link to external url. I do have the link module installed, but there is no way for me to apply that field to the url of the title.
I have spent a while googling around trying to find the answer, but without much success. If there is nothing available to do this already, I wouldn’t mind building a module and submitting it to the community. Just want to make sure I’m not missing anything.
Thanks in advance.
UPDATE
Here are the steps I took using the answer given below:
- Install the link module: http://drupal.org/project/link
- Create a content type, add a field for
link - Add new content of that type and add the url you want to link to in
thelinkfield - Create a view and filter by that content type
- Under format, i’m using
format: "grid"withshow: "fields" - Add a field for the
Content: linkfield you created FIRST* in the list.
Set toExclude from displayandFormatter: URL, as plain text - Add a title field and deselect “Link this field to the original
piece of content” click on “rewrite results” and select “rewrite the
output of this field”. Enter<ain the text field where
href="[field_link_to]">[title]</a>
[field_link_to]is the name of the link field as described in the
“replacement patterns” dropdown below it.- If you do not have the link field in your list of fields FIRST, the token will not be available to the fields below it.
- In your Content Type > Manage Fields > Link (edit) > Wrapper markup, make sure “no markup” is selected
You can alter the display of the view using the rewrite options. Make sure your display type is set to ‘fields’. Then include the fields you want to display; title, teaser, image.
In the field configuration of the title field, choose ‘rewrite results’. there you can enter the following
<a href="example.com">[title]</a>That should overrule the title.Also make sure to uncheck ‘link the field to it’s node’.
UPDATE: You might have to create a second view for this… To prevent editing the other two elements.