You are here

function _crm_core_activity_type_default_field_instances in CRM Core 7

Defines the default field instances for the CRM Core Activity entity type.

Parameters

string $type: Activity type to get instances for.

Return value

array Field instances.

1 call to _crm_core_activity_type_default_field_instances()
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

modules/crm_core_activity/crm_core_activity.fields.inc, line 87
Adds fields to the activity entity type used by CRM Core.

Code

function _crm_core_activity_type_default_field_instances($type) {
  $instances = array();

  // Participants field.
  $instances[] = array(
    'field_name' => 'field_activity_participants',
    'entity_type' => 'crm_core_activity',
    'bundle' => $type,
    'label' => t('Participants'),
    'required' => TRUE,
    'settings' => array(
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'type' => 'entityreference_autocomplete_tags',
      'module' => 'entityreference',
      'active' => 1,
      'settings' => array(
        'match_operator' => 'CONTAINS',
        'size' => 60,
        'path' => '',
      ),
    ),
    'display' => array(
      'default' => array(
        'label' => 'above',
        'module' => 'entityreference',
        'settings' => array(
          'link' => 1,
        ),
        'type' => 'entityreference_label',
        'weight' => '0',
      ),
    ),
  );

  // Date field.
  $instances[] = array(
    'field_name' => 'field_activity_date',
    'entity_type' => 'crm_core_activity',
    'bundle' => $type,
    'label' => t('Date'),
    'required' => FALSE,
    'settings' => array(
      'default_value' => 'now',
      'default_value_code' => '',
      'default_value2' => 'blank',
      'default_value_code2' => '',
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'weight' => '1',
      'type' => 'date_popup',
      'module' => 'date',
      'active' => 1,
      'settings' => array(
        'input_format' => 'm/d/Y - H:i:s',
        'input_format_custom' => '',
        'year_range' => '-3:+3',
        'increment' => '15',
        'label_position' => 'above',
        'text_parts' => array(),
        'repeat_collapsed' => 0,
      ),
    ),
    'display' => array(
      'default' => array(
        'label' => 'above',
        'type' => 'date_default',
        'settings' => array(
          'format_type' => 'long',
          'show_repeat_rule' => 'show',
          'multiple_number' => '',
          'multiple_from' => '',
          'multiple_to' => '',
          'fromto' => 'both',
        ),
        'module' => 'date',
        'weight' => 1,
      ),
    ),
  );

  // Participants field.
  $instances[] = array(
    'field_name' => 'field_activity_notes',
    'entity_type' => 'crm_core_activity',
    'bundle' => $type,
    'label' => t('Notes'),
    'required' => FALSE,
    'settings' => array(
      'text_processing' => '0',
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'weight' => 2,
      'type' => 'text_textarea',
      'module' => 'text',
      'active' => 1,
      'settings' => array(
        'rows' => 5,
      ),
    ),
    'display' => array(
      'default' => array(
        'label' => 'above',
        'type' => 'text_default',
        'settings' => array(),
        'module' => 'text',
        'weight' => 2,
      ),
    ),
  );
  return $instances;
}