/** * Provide a list of available entityRef filters. * @todo: move component filters into their respective components (e.g. CiviEvent) * * @return array */ public static function getEntityRefFilters() { $filters = array(); $config = CRM_Core_Config::singleton(); if (in_array('CiviEvent', $config->enableComponents)) { $filters['event'] = array(array('key' => 'event_type_id', 'value' => ts('Event Type')), array('key' => 'start_date', 'value' => ts('Start Date'), 'options' => array(array('key' => '{">":"now"}', 'value' => ts('Upcoming')), array('key' => '{"BETWEEN":["now - 3 month","now"]}', 'value' => ts('Past 3 Months')), array('key' => '{"BETWEEN":["now - 6 month","now"]}', 'value' => ts('Past 6 Months')), array('key' => '{"BETWEEN":["now - 1 year","now"]}', 'value' => ts('Past Year'))))); } $filters['activity'] = array(array('key' => 'activity_type_id', 'value' => ts('Activity Type')), array('key' => 'status_id', 'value' => ts('Activity Status'))); $filters['contact'] = array(array('key' => 'contact_type', 'value' => ts('Contact Type')), array('key' => 'group', 'value' => ts('Group'), 'entity' => 'group_contact'), array('key' => 'tag', 'value' => ts('Tag'), 'entity' => 'entity_tag'), array('key' => 'state_province', 'value' => ts('State/Province'), 'entity' => 'address'), array('key' => 'country', 'value' => ts('Country'), 'entity' => 'address'), array('key' => 'gender_id', 'value' => ts('Gender')), array('key' => 'is_deceased', 'value' => ts('Deceased')), array('key' => 'source', 'value' => ts('Contact Source'), 'type' => 'text')); if (in_array('CiviCase', $config->enableComponents)) { $filters['case'] = array(array('key' => 'case_id.case_type_id', 'value' => ts('Case Type'), 'entity' => 'Case'), array('key' => 'case_id.status_id', 'value' => ts('Case Status'), 'entity' => 'Case')); foreach ($filters['contact'] as $filter) { $filter += array('entity' => 'contact'); $filter['key'] = 'contact_id.' . $filter['key']; $filters['case'][] = $filter; } } CRM_Utils_Hook::entityRefFilters($filters); return $filters; }