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

 
Edit Article Google+ nối dài “cơn ác mộng” mạng xã hội của Google?

Google+ nối dài “cơn ác mộng” mạng xã hội của Google?

Nhiều nhà phân tích của giới truyền thông và công nghệ Mỹ cho rằng Google+ lại tiếp tục là một sự thất bại trên lĩnh vực mạng xã hội của Google.

Phần 1 - Cài đặt, model và CRUD trong Symfony 2

Giải nén → đổi tên thư mục Symfony thành sfdemo, sao chép vào thư mục “/var/www”

Galaxy Nexus tới Canada vào 7/12

Galaxy Nexus tới Canada vào 7/12

Galaxy Nexus của Samsung, smartphone đầu tiên chạy Android 4.0, sẽ được bán qua các nhà mạng ở Canada từ ngày 7/12/2011, và hiện cũng đã được bán ra ở Anh.

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

 

Diet con trung