These are notes to myself about customizing CiviCRM. I have CiviCRM in Drupal but the notes are not specific to Drupal, at least I don’t think they are.
Customize Built-in, Profile, Contribution and Event Registration Screens
Related: http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
There are at least 5 different ways of using an API function. In each environment, the API uses the same names for entities, actions, and parameters, but the syntax is slightly different. Entities are the data collections you want to operate on, for example Contact, Event or Group. The actions are the thing you want to do to the entity, for example get, create, delete or update.
You can use the API:
- as a PHP function, to run your own code on the same server as CiviCRM
- via the AJAX interface, to be called from JavaScript code
- via the REST* interface, can be called from another server via http/https calls
- as a Smarty function to add data to templates
- from drush on the command line for Drupal installations.
Limit the list of contacts to search when assigning a case role
The contact selector is an EntityRef field. If you’d like to “enforce” a certain group or other filter on this field, you can do so with a small amount of custom code on your site.
Modifying a form in CiviCRM depends on how the form is generated. Because this form is written in javascript, I recommend adding a custom js file to the CiviCase dashboard screen. It simply needs to add data to the two fields (edit_role_contact_id
and add_role_contact_id
) that specifies the group_id of your group.
You can either use a custom module/plugin on your website or create an extension to add your javascript file using CRM_Core_Resources from a hook. hook_civicrm_caseSummary might be a good one, you wouldn’t be using it for exactly its intended purpose but it fires on the right screen.
The contact selector is an EntityRef field. If you’d like to “enforce” a certain group or other filter on this field, you can do so with a small amount of custom code on your site.
Modifying a form in CiviCRM depends on how the form is generated. Because this form is written in javascript, I recommend adding a custom js file to the CiviCase dashboard screen. It simply needs to add data to the two fields (edit_role_contact_id
and add_role_contact_id
) that specifies the group_id of your group.
You can either use a custom module/plugin on your website or create an extension to add your javascript file using CRM_Core_Resources from a hook. hook_civicrm_caseSummary might be a good one, you wouldn’t be using it for exactly its intended purpose but it fires on the right screen.
Configure extensions
http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions
Install civix for civicrm
http://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension
https://github.com/totten/civix/
Create a module extension
http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension
Module to demonstrate CiviCRM hooks
https://github.com/eileenmcnaughton/civicrm_developer
Hook reference
http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference#HookReference-Goalsandbackground
hook_civicrm_buildForm — This hook is invoked when building a CiviCRM form. This hook should also be used to set the default values of a form element, to change form elements attributes, or even to add new fields to a form.
http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
Examples:
set “Assigned To” for an Activity to default to the logged-in user name?
You cannot influence the activity source contact with the membership API Create action, but interesting discussion