I've recently been exploring creating CiviCRM entities as Drupal entities - using the drupal Entity API. I think so far I have only just touched the surface of the possibilities for this integration but I thought I'd post what I think some of them might be
- Rules integration
- Entity Reference fields
- Solr searching (not explored)
- Views bulk operations (not explored)
- Attaching drupal fields to CiviCRM entities (within drupal) (not explored)
Rules integration
Given Pete's love of Organic Groups most of what I have done so far is worked with adding OG integrations for Events and adding roles to users when they get relationships. Some potentials Pete has spotted are
- The rules integration creates the potential to create users in various back-office situations such as manual event registrations, contact imports or potentially a batch profile update or a views bulk integration
- Lots of opportunities to sync all sorts of things with Organic Groups :-) We are using a model when an OG is created for each event and participants added to the event have drupal accounts added (back office too) or loaded & those accounts are added to the event OG.
- We are also giving users a role based on their contact relationships
- Rules basically gives the power of civicrm_post hooks to non coders
Entity References
Basically the entity module allows you to have an entity reference field for any type of entity. So, instead of just the existing contact reference field you can add an entity reference field to a relationship type or an event.
The entity reference then allows you to create views that incorporate both the entity with the reference and the one referred to without any extra code.
Chaining & tokens
I haven't looked so much at tokens but drupal has an idea of chaining so you can potentially add a token that gets an event participant's current employer & displays that or the event's creators username. At the moment I have made contact_id fields chainable.
Code is here - but we are running it against a patched version of 4.2 (or unpatched 4.3 in a sandbox)
https://github.com/eileenmcnaughton/civicrm_entity
(Our patched version is https://github.com/fuzionnz/civicrm - Branch 4.2-d7)
Comments
I've also implemented a similar integration. See https://github.com/bangpound/civicrmentity/ for my work. I've turned CiviCRM groups and contacts into fieldable entities -- though this was just to prove it could be done. The actual functioning work there was to create Drupal entities for CiviEvents so that the event calendar of CiviEvents can be classified by Drupal taxonomy fields.
Thanks for working on this. It sounds like exactly the solution I sat down last night to begin to work out. I have a set of taxonomy terms that are equally applicable to my ordinary Drupal Calendar events and CiviCRM events. The views that generate a combined calendar are working nicely but filtering requires a shared taxonomy. Any advice before I plunge into attempting to implement your code?
Cool - I'll take a look though & make sense of what you have done. From what I can see you have tackled mostly the bits I didn't tackle (which is nice)
Any news on these modules? I'm very curious about what can be accomplished with them, and I've got some crazy ideas. Is there any plan for developing further?
I think the most active discussion on these is on
http://drupal.org/sandbox/eileen/1923028
& on
https://github.com/eileenmcnaughton/civicrm_entity
NB at any given time code on github is probably more up-to-date that on drupal but conversation on drupal seems more up-to-date