Creating custom date tokens
Sometimes there is a token that is not available to you, so you will have to create it programmatically. This recipe shows a very simple example of adding a date token for the current date. It uses plugin code , which means you can substitute different token values.
Getting ready…
You don't really need to know much PHP but it helps if you know the basics of how to set up a basic Drupal module.
How to do it…
In this recipe we will create our own Drupal module to do the work. This is not too intimidating, particularly as our code is readily available online.
Create a folder in
/sites/all/modules
and give it a suitable name. Let's call this oneCookbook
.Inside this folder create a file called
cookbook.info
.Open
cookbook.info
and add in the basic code that Drupal needs to identify the module:name = Cookbook description = Custom CiviCRM functions core = 7.x files[] = cookbook.module
Easy!
Create a file called
cookbook.module
and add in this code:<?php function cookbook_civicrm_tokens...