Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround for views activity related fields. #460

Draft
wants to merge 1 commit into
base: 4.0.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions civicrm_entity.views.inc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ function civicrm_entity_views_data_alter(&$data) {
$data['civicrm_contact']['current_employer']['real field'] = 'organization_name';
$data['civicrm_contact']['employer_id']['field']['id'] = 'standard';
$data['civicrm_contribution']['contribution_source']['real field'] = 'source';

$service = \Drupal::service('entity_field.manager');
$field_definitions = $service->getFieldDefinitions('civicrm_activity', 'civicrm_activity');

foreach (['status_id', 'activity_type_id'] as $key) {
$data['civicrm_activity'][$key]['filter']['id'] = 'in_operator';
$data['civicrm_activity'][$key]['filter']['options callback'] = 'civicrm_entity_pseudoconstant_options';
$data['civicrm_activity'][$key]['filter']['options arguments'] = [$field_definitions[$key]];
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CivicrmEntityViewsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ protected function processViewsDataForSpecialFields(array &$views_field, $base_t
$views_field['civicrm_contact']['reverse__civicrm_website__contact_id']['relationship']['id'] = 'civicrm_entity_reverse_website_type';
$views_field['civicrm_contact']['reverse__civicrm_website__contact_id']['relationship']['label'] = $this->t('Website');
}

break;
case 'civicrm_address':
if (isset($views_field['civicrm_contact']['reverse__civicrm_address__contact_id']['relationship'])) {
Expand Down
Loading