How to get custom tokens in Drupal module?
To get custom tokens in drupal we’ll use the token api functions hook_token_values () and hook_token_list () (you ll put this piece of code in your_module.module) The hook_token_list will provide data to the interface and the hook_token_values will replace the token [package:package_name] you’ll put in your mails.
How to write your own events, actions and custom tokens?
When the condition is assessed the function your_module_condition_package_type is executed using the argument pid (package id) provided by the event and the argument type defined in the interface. The function will return true if the package type bought is the same as the package type defined in the interface.
How to write your own custom rules, events and custom object?
* Implementation of hook_rules_event_info (). What we have done is defined an action that registers the acting user and the package object. Let’s trigger that action when we buy a package. (This function will be located in your_module.module)
How does the rules module work in Drupal?
As demonstrated rules is a powerfull module, with an equally powerfull api capable of defining custom events, conditions and actions. Rules integrates with all major modules (and the token api), and it is imho when developing modules, if possible, a point of integration worth to consider.
How does the rules package work in Drupal?
Rules integrates with all major modules (and the token api), and it is imho when developing modules, if possible, a point of integration worth to consider. For more information about the api see the rules.api.php file in the rules package.
How to write custom event conditions in Drupal?
There are 3 hooks you ll need to implement, so create a custom module and create an extra file called your_module.rules.inc, all our code rules related code will go in there. The first hook is hook_rules_event_info () and will defne our custom event. * Implementation of hook_rules_event_info ().
How to define a triggered rule in Drupal?
In the rules interface on the site you ll define your triggered rule by selecting this event. Notice how we log the event in the watchdog. This is good practice because you want to follow up what happens on your site.