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

 
Thêm Custom Breadcrumbs cho Views Pages

Thêm Custom Breadcrumbs cho Views Pages

Recently I needed to add custom breadcrumbs to views 2 generated pages.

13 gotcha giúp bạn sử dụng và developing trong Drupal land

13 gotcha giúp bạn sử dụng và developing trong Drupal land

Half a year ago I wrote a blog post about various stumble blocks I had run into in my first year as a Drupal developer

Drupal tại sao chọn - Why choose Drupal?

Drupal tại sao chọn - Why choose Drupal?

Drupal is the leading open source content management system for developing sophisticated, flexible and robust websites, social media networks and applications.

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

 

Diet con trung