summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Roskolii2018-08-29 06:30:49 (GMT)
committerKirill Roskolii2018-08-29 06:30:49 (GMT)
commitdff6d5a038ef2d177c420f66946efce39b12891c (patch)
tree40db0273626a717e2464dacf729cbed7d5a7bb5f
parent0cc156c7f228df0aa2d66e2fb2162de1283c22bf (diff)
Added relation reverse references data for views.
-rw-r--r--modules/crm_core_user_sync/crm_core_user_sync.module33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/crm_core_user_sync/crm_core_user_sync.module b/modules/crm_core_user_sync/crm_core_user_sync.module
index d81ac27..50693fa 100644
--- a/modules/crm_core_user_sync/crm_core_user_sync.module
+++ b/modules/crm_core_user_sync/crm_core_user_sync.module
@@ -93,3 +93,36 @@ function crm_core_user_sync_user_view(array &$build, UserInterface $account, Ent
}
}
}
+
+/**
+ * Implements hook_views_data_alter().
+ *
+ * @todo Remove once https://www.drupal.org/project/drupal/issues/2706431 is
+ * resolved.
+ */
+function crm_core_user_sync_views_data_alter(array &$data) {
+ $title = t('CRM Core User Sync Relation');
+ $data['users_field_data']['crm_core_user_sync_relation'] = [
+ 'title' => $title,
+ 'help' => t('Adds relation to CRM Core User Sync Relation that point to current user.'),
+ 'relationship' => [
+ 'base' => 'crm_core_user_sync_relation',
+ 'base field' => 'user_id',
+ 'field' => 'uid',
+ 'id' => 'standard',
+ 'label' => $title,
+ ],
+ ];
+
+ $data['crm_core_individual']['crm_core_user_sync_relation'] = [
+ 'title' => $title,
+ 'help' => t('Adds relation to CRM Core User Sync Relation that point to current individual.'),
+ 'relationship' => [
+ 'base' => 'crm_core_user_sync_relation',
+ 'base field' => 'individual_id',
+ 'field' => 'individual_id',
+ 'id' => 'standard',
+ 'label' => $title,
+ ],
+ ];
+}