This is an attempt to add a hierarchical custom data type for use in CiviCRM with the parent/child structure defined by a Drupal vocabulary.
Whew! Finally got something worth showing. It's pretty rough and not fully integrated with CiviCRM. My goal half way through switched from a full solution to something that would work with minimal impact on the civicrm codebase. I'm hoping someone else can take this another step. For now, this is all I need.
Installation
Back up exisiting database
mysqldump -u _dbuser_ -p --opt _dbname_ > mydb-backup.sql
Back up existing civicrm install
from %webroot%/html/modules
tar -cf civicrm-backup.tar.gz civicrm/
Create the civicrm_entity_term table
civicrm_entity_term.sql is attached.
mysql> source civicrm_entity_term.sql
Custom Changes
Edit CRM/Utils/Menu.php
after line 395
array(
'path' => 'civicrm/contact/view/tax',
'qs' => 'reset=1&cid=%%cid%%',
'title' => ts('Interest Areas'),
'type' => CRM_UTILS_MENU_CALLBACK,
'crmType' => CRM_UTILS_MENU_LOCAL_TASK,
'weight' => 1
),
Edit CRM/Core/Invoke.php
on line 174, after the tag switch section
case 'tax':
require_once 'CRM/Taxonomy/Page/View.php';
$view =& new CRM_Taxonomy_Page_View( );
break;
Add the Vocabulary and terms into Drupal
use the drupal administration/categories to setup your categories
Edit civicrm.settings.php
This file is usually found under %webroot%/sites/default
Insert after line 442 but before the 'Do not change anything below this line' section
/** * Specify the Drupal vocabulary id to use with Interest Areas */ define( 'CIVICRM_DRUPAL_VOCABULARY_ID' , ?);
Where '?' is the id of the Drupal vocabulary.
You can find the Id by looking at the URL of the edit vocabulary link under the drupal administration/categories menu.
ie
http://webroot/?q=admin/taxonomy/edit/vocabulary/1 <--- id = 1
or
on the drupal database run
SELECT vid, name FROM vocabulary
and pick out the vid for the name of your vocabulary.
Extract New Files into <webroot>htdocs/modules directory
- cd %webroot%/html/modules (whever civicrm dir lives)
- wget %weburl%/civicrm.zip
- unzip civicrm.zip
civicrm.zip attachment contains the files below.
- civicrm/api/Taxonomy.php
- civicrm/CRM/Taxonomy/Form/Edit.php
- civicrm/CRM/Taxonomy/Page/View.php
- civicrm/templates/CRM/Taxonomy/Page/View.tpl
This is a very, very custom solution. Due to time I could not go further as I have to dive into how to get the search page to recognize the vocabulary terms. ![]()
Original scope
Specifically, we want to allow 0 to Many "Interest Areas" to be added on an Individual.
Areas of Integration
- Individual
- Advanced Search -> want to "OR" the entries for a broader search.
- Admin interface for Custom Fields
- Custom Data Groups
- Custom Data Fields
- Hook into Drupal vocabulary/term structure.
Use Cases
User
- Name: Select "Interest Areas" for an Individual.
- Success End Condition: "Interest Area" added to Individual.
- Name: Search for Individuals that have selected "Interest Areas"
- Success End Condition: Search returns Individuals with "ANY" of the selected "Interest Areas"
Administrator
- Name: Create Hierarchical Custom Data Group
- Success End Condition: Hierarchical Custom Data Group appears in admin interface.
- Name: View and Edit Custom Fields for Hierarchical Custom Data Group
- Success End Condition: Field is added.
Progress
Task |
Status |
|---|---|
Printing out id's, parent ids, and category from within CiviCRM on a Hello World page. |
Done |
Looking into using Drupals vocabulary and term db structures |
In Progress |
Investigating Custom Data Groups and Fields |
In Progress |
Notes
- I wanted to get this "out there" so I'll try to fill out more detail as I go along.

3 Comments
Hide/Show CommentsFeb 04, 2006
David Geilhufe
Great contribution, Eric!
Mar 10, 2006
Someone
Just what is needed! Have you got any further with this Eric, and is it available for public download?
Dec 15, 2008
James Liu
Any updates for civicrm 2.x above?
This is a very useful feature for CiviCRM.