1

I am looking for a way to trigger a rule when clicking on a link. What I am actually trying to do, is fireing a VBO with a Button, instead of the Dropdown solution. For this, I created a Rules-Component that does the job, but I don't know how to fire that rule, as it should start from within a view.

3

take a look at Rules Link:

This module lets you create links which trigger arbitrary functionality with the help of Rules.

2

First of all, rules components cannot be triggered on their own. You will need to create a rule for that that will be triggered when one event occurs. Then you should write some code. I would do it like this:

  • have a custom page in your module (Eg: "actions/my-custom-rule")
  • trigger the rule using rules_invoke_event('the_event', $params);
  • redirect the user back to the previous page using drupal_goto(drupal_get_destination());

If the event is something custom, you need to define the event in your module. Find out more about integrating rules in your module from here.

1
  • Thanks for that info. Then I missunderstood rules. When I do have my own implementation in a custom module I can do the action there without rules anyway.
    – Andi
    Sep 16 '14 at 13:50
0

I am looking for a way to trigger a rule when clicking on a link.

This is answered correctly by @geoff

What I am actually trying to do, is fireing a VBO with a Button, instead of the Dropdown solution. For this, I created a Rules-Component that does the job, but I don't know how to fire that rule, as it should start from within a view.

This is a setting in the views panel. Click the field "Views bulk operations" and select to expose each component as a separate button instead of a droplist under "Bulk operations settings".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.