Developing a CiviCRM Drupal module
In this recipe, we will explore how a CiviCRM Drupal
module works. The basic code for this module is already available online.
How to do it…
In this example, we have a contact that is in a specific group. We are going to fire off an e-mail if someone edits that contact.
- Set up your own local development environment.
- Download, install, and enable the Drupal Devel module, available at http://drupal.org/project/devel.
- Navigate to https://github.com/eileenmcnaughton/civicrm_developer.
- Download the ZIP file for the module and expand it. It expands as a directory called
civicrm_developer-master
. - Rename it
civicrm_developer
. - Install and enable the module.
- In CiviCRM, add a contact to a group. Make a note of the contact ID; in this case, it was 51.
Here, a contact was added to the Media group.
- Navigate to Contacts | Manage groups. Note the ID of the Media group. In this case, the ID was 7. In your own implementation, the ID is likely to be different.
- Click on the Edit...