Using Rules and Views Bulk Operations

In a previous article I described how to use the EVA and Entity Reference modules to create a simple reviews system for the Article content type.  To improve this system, it would be good if when an Article is deleted, that all the reviews that reference that Article are also deleted.

To do this we will use Rules, Conditional Rules, and Views Bulk Operations

Rules

The rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules). It's a replacement with more features for the trigger module in Drupal core.

Example use cases

  • Build flexible content publishing workflows changes
  • Send customized mails to notify your users about important events
  • Create custom redirections, system messages, breadcrumbs, ...
  • Altering variable or entity data depending on user role
  • Executing custom php code after comment added
  • Deleting entities that reference an entity that is being deleted

The Rules module reacts to Events and performs various actions when those events occur. Conditions can be applied to rules. Once an event triggers Rules, and the set conditions are met, Rules can perform various actions or loops of actions.

Rules Components

Rules components can be used to organize combinations of actions or conditions. For example, you may have many actions you wish to take after one type of event. You an event may invoke a rules action component which will contain several action rules which will fire when your event happens. This is handy because it allows you to organize and separate each action for simpler editing especially in the case of complicated conditions for executing an action.

http://drupal.org/project/rules

Conditional Rules

Conditional Rules allows much more flexibility in the conditioning of rules actions. Adds If/Else, switch, and while structures to be placed in the actions area of a Rule

http://drupal.org/project/rules_conditional

Views Bulk Operations

Views Bulk Operations creates an interface to perform actions on views query result entities. In Rules it adds an action to load a list of entity ids or objects which can be acted on by other rules actions.

http://drupal.org/project/views_bulk_operations

How-To Guide

Create VBO View to use in rule

  1. Create a new view showing content of type review, no page or other views displays.
  2. Add a field Bulk Operations: Content and at least one other field
  3. Settings for the Bulk Operation field, Under 'Selected Bulk Operations', Check the Delete item checkbox,
  4. Add contextual filter which is the entity reference field
  5. Pager settings: display all items

Create Rule

  1. Create new Rule React to event: After deleting content
  2. Add condition: ‘Content is of type’ and select Article
  3. Add action: Load a list of entity objects from VBO view
  4. Select New view that was created in steps 1‐4 and pass the node:nid (of deleted node) as the argument to the view
  5. Name the List Reviews List
  6. Add Loop, list to act on is Reviews List, can change name of current item is list (optional)
  7. Nested in loop add action Delete Entity, use [list‐item] or whatever you named the current list item

Tags: 

Comments

miom

Produk Jelly Gamat -Not only good for health but also very useful for the treatment, Ace maxs made from mangosteen peel and soursop leaves, Had a very remarkable properties. Because the content is owned mangosteen peel is needed by the human body.recent post- Ace Maxs

SQL is a question dialect

SQL is a question dialect or, all the more precisely, THE inquiry dialect for social databases. Each RDBMS as of now in across the board utilize (that I am aware of at any rate), utilizes SQL (though more often than not with their own specific expansions.) Oracle is the same in this regard. To hone SQL on Oracle, you'll have to introduce it on your PC (most likely the free Express form.) Then you execute SQLPLUS, which is Oracle's summon line execution application, where you can enter SQL orders and see the outcome. For a significantly more easy to use UI, you'd need to horse up for the full form. Assignment land uk 

In that time i can bulk up

In that time i can bulk up very fast. i will lift heavy weights due to the fact, like most people, I started out off with heavy exercises. it really is stayed in my muscle memory. I sense terrible after I experience my jeans have become tight. exercises peace me out.    Honda Biker Jacket

Cara Mengobati Kanker Rahim dengan Sarang Semut

<a href="http://tokoherbaltasik.com/penyebab-sakit-telinga-pada-ibu-hamil/">Penyebab Sakit Telinga pada Ibu Hamil</a><a href="http://obatinfeksirahim.tipssehatonline.web.id/cara-alami-mengobati-kank... Alami Mengobati Kanker Rahim dengan Sarang Semut</a><a href="http://www.pengobatanhipertensi.info/olahraga-untuk-mengatasi-hipertensi... untuk Mengatasi Hipertensi pada Ibu Hamil</a><a href="http://obatlukapayudara.com/usia-rentan-terkena-kanker-payudara/">Usia Rentan Terkena Kanker Payudara</a><a href="http://jianxincapsule.com/cara-alami-mengobati-jantung-bengkak-pasca-mel... Alami Mengobati Jantung Bengkak Pasca Melahirkan</a>

Great lesson taught

In this tough job market, it is becoming immensely difficult for <a href="https://myassignmenthelp.com/uk/mechanical-assignment-help.html">mechanical engineering</a> students to establish a promising professional career. The reason being students need to accomplish several assignments that contribute to the annual assessment of students.  <a href="https://myassignmenthelp.com/uk/">https://myassignmenthelp.com/uk/</a>

<ahref="http://qnc-jellygamat

Thanks for sharing this

Thanks for sharing this information i read above whole information and i mostly like above three points : 

  1. Create new Rule React to event: After deleting content
  2. Add condition: ‘Content is of type’ and select Article
  3. Add action: Load a list of entity objects from VBO view

Besides that, you can get more about your assignment help like how can you get good marks in assignment so check this out.

I really enjoyed reading your

I really enjoyed reading your article. I found this as an informative and interesting post, so I think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article. las

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.