Hướng dẫn thêm Links to Fields trong Views

Hướng dẫn thêm Links to Fields trong Views

>> Hướng dẫn code entity reference trong custom entities (no bundles)

This blog post is the answer to a common request we get from people learning how to use Views.

The question is: "How do I automatically add a link to a field"?

The answer is straightforward, once you know how.

Imagine that you have a content type that looks like the image below. You have an active link using the Link module and also some other fields.

media_1397067314201.png

Now imagine that we're using Views to show some of items in that content type. Here's a photo gallery using Views. If you don't know how to do this, use our tutorial "Creating a Photo Gallery in Drupal 7".

media_1397067634329.png

Now let's show you to automatically add links.

In this example, we're going to automatically link the Movie Poster field to the "Official Website" field.

Inside our view, the image below shows how the fields look currently. We have a Title and Movie Poster field.

media_1397067669374.png

We're going to add the Movie Poster field.

  • Click "Add" next to "Fields"
  • Choose "Official Website"
  • Check the "Exclude from display" box because we don't want this to be visible.

media_1397067714138.png

  • Save the field. It should show at the bottom of the three fields.
  • Click the "Rearrange" button under "Add"

media_1397067799410.png

  • Rearrange the fields so that the Official Website field is before the Movie Poster field.

media_1397067837174.png

  • Click the Move Poster field.
  • Check the "Output this field as a link" box.

media_1397067876071.png

  • Scroll down to the Replacement Patterns area.
  • Find the replacement pattern for the Office Website field.

media_1397067887537.png

  • Copy the replacement into the "Link path" field:

media_1397067914966.png

  • Save the field and then save the view.

You've finished and your movie posters will be automatically linked to the official website.

 

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Dev dự án Pebble Application to Record a Geo Location in Drupal

Dev dự án Pebble Application to Record a Geo Location in Drupal

This tutorial describes how to build a Pebble "smart watch" application for a Drupal website using the PebbleKit Javascript Framework.

Tính năng rất hay trong Open Atrium’s New Related Content

Tính năng rất hay trong Open Atrium’s New Related Content

In the latest 2.30 version of Open Atrium, we attempt to help both content editors and web developers

14 Drupal Themes miễn phí tốt nhất

14 Drupal Themes miễn phí tốt nhất

Free Drupal themes are in high demand, because of the versatility and growing popularity of DrupalCMS.  While Drupal can be used for blogging platforms in a similar manner to WordPress, Drupal’s core is also suited to eCommerce, social media and other applications, thanks to the large extensibility of the features.

Công ty diệt chuột T&C

 

Diet con trung