You are here

function hook_crm_core_activity_type_add_field_instances_alter in CRM Core 7

Provides possibility to change default field instances that will be added to the recently created bundle of activity.

Parameters

$instances: Array with field instances that are going to be added to the activity bundle.

CRMActivityType $activity_type: Bundle of activity entity that was recently created.

See also

field_create_instance()

_crm_core_activity_type_default_field_instances()

1 invocation of hook_crm_core_activity_type_add_field_instances_alter()
crm_core_activity_type_add_default_fields in modules/crm_core_activity/crm_core_activity.admin.inc
Add default fields to newly created activity type.

File

./crm_core.api.php, line 97
Hooks provided by the CRM Core module.

Code

function hook_crm_core_activity_type_add_field_instances_alter(&$instances, CRMActivityType $activity_type) {

  // Prevent field_activity_date from adding to an activity bundle.
  foreach ($instances as $key => $instance) {
    if ($instance['field_name'] == 'field_activity_date') {
      unset($instances[$key]);
    }
  }
}