Hướng dẫn gắn taxonomy terms to nodes sử dụng Views Bulk Operations

How to batch assign taxonomy terms to nodes using Views Bulk Operations

Graph Query Language do Facebook tạo ra từ năm 2012

Average: 9.5 (13 votes)

Làm thế nào để tương tác với hệ sinh thái của React JS hiệu quả

Average: 9.4 (13 votes)

Hướng dẫn gắn taxonomy terms to nodes sử dụng Views Bulk Operations

In this article I am going to show you a quick trick that will allow you to assign taxonomy terms to a lot of nodes all at once. For this we will use Views and Views Bulk Operations and will require no coding whatsoever. So let's begin.

First off, make sure you have the 2 modules installed. Drush will quickly take care of that for you if you don't have them yet:

drush dl ctools views vbo && drush en ctools views views_ui vbo

Now, the next thing we need to do is create a View page that displays the content (nodes, users, etc) you'd like to operate on in bulk (in our case, add taxonomy terms to). Make sure it uses fields and for start, the title field will be enough. For filtering, use whatever you need to filter the View to show only the content you want and sorting doesn't really matter.

Next up, add a new field of the type:Bulk operations: Content . This will provide next to the node title a checkbox for you to select that node to be part of the bulk operation.

To configure this field, make sure you check the boxes Modify entity values and Show available tokens followed by selecting the values of which field you'd like changed (in our case the taxonomy term reference field). In the screenshot below, you can see my selection for the Tags field of the Article node (I am going with a node view displaying articles).

Now you can save the View and navigate to its page. In the image below you can see my example. A table formatted view with the checkbox and the Article node title to its right. And the VBO operations above it.

How to batch assign taxonomy terms to nodes using Views Bulk Operations

Now, let's say I want to apply a taxonomy term to all these nodes. I can select them all (either manually or using the top-most checkbox dedicated for selecting all rows at once), choose my operation (Modify entity values) and click Execute. And this is then my next screen:

I have an autocomplete widget (like the default Article content type Tags field referencing taxonomy terms) where I can select one or more terms I'd like applied to all those nodes. I also have an option to ensure that existing values do not get overriden, by checking the respective checkbox. And lastly, I have some tokens available to use (because of the Tokens module).

Once I select my terms and press Next, I get an overview of how many nodes are going to be affected by this change (as you can see below). And that's basically it.

One thing to keep in mind here. If you are adding a non already existing taxonomy term, VBO will create that term as many times as the number of nodes being processed. So you'll end up with a bunch of terms with the same title. Probably not something you either expect or want. I therefore recommend you create your term before and then apply it to the content.

Hope this helps!

Bạn thấy bài viết này như thế nào?: 
Average: 5 (1 vote)

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ùng rác" tự động bằng AppleScript cho Mac
"Đổ thùng rác" tự động bằng AppleScript cho Mac

Thủ thuật này chỉ có hiệu nghiệm khi bạn áp dụng đoạn code, không phải là mọi lúc đều tự động xóa sạch nội dung Trash.

Dùng Facebook để quảng cáo, tiếp thị trực tuyến
Dùng Facebook để quảng cáo, tiếp thị trực tuyến

Khi quyết định sử dụng một kênh quảng cáo tiếp thị nào, ta cần phải đánh giá hiệu quả thu được dự kiến dựa trên các con số thực tế. Bài viết này sẽ đưa ra một số thông tin cụ thể hơn nhằm giúp các bạn nắm được các thông tin cơ bản về lượng người dùng của Facebook.

iOS 5.1 Outs New iPhone, iPad, and Apple TV Models
iOS 5.1 Outs New iPhone, iPad, and Apple TV Models

Earlier today, Apple released iOS 5.1 Beta. As usual, hackers got right to work dissecting the software to see if there were any secrets hidden within its source code. Previous code-digging has uncovered features like FaceTime over 3G.