This project is not covered by Drupal’s security advisory policy.

Working with CiviCRM api is very hard in Drupal. Let's simplify it!

Well, let's try to tell, why I'm doing this:

The first, get the civicrm constant 'wysiwygEditor' with civiapi V3:

 if (!civicrm_initialize()) {
     return;
  }
 $params = array (
   'version' => 3;
   'name' => 'wysiwygEditor';
  )

 $result = civicrm_api('constant', 'get', $params);
  $wysiwygEditor = $result['values'];

And get the same with civi_api:

  $wysiwygEditor = civi_get_constant('wysiwygEditor');

The $result = civicrm_api('constant', 'get', $params); in civiapi V3 returns an array with error code, error message, but just 'return', nothing to happend with this.

With civi_api, if some error is, you get the error message by drupal_set_message, and create a watchdog notice about this.

This example is a simple 'get something'. With this api you can load civicrm contacts like a drupal user object (with its civicrm groups), it uses drupal_static function to cache loaded contacts.

You can get exisiting civicrm profile simply, and embed it your own form.

It will provide drupal hooks to alter objects before saving, loading, etc.

Based on this module I've started to refactor the main CiviCRM drupal modules, see: http://drupal.org/sandbox/szantog/1396726

Project information

Releases