Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 45 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| MiscHooks | |
0.00% |
0 / 45 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| viewsDataAlter | |
0.00% |
0 / 45 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Drupal\crm\Hook; |
| 4 | |
| 5 | use Drupal\Core\Hook\Attribute\Hook; |
| 6 | |
| 7 | /** |
| 8 | * Hooks relating to miscellaneous. |
| 9 | */ |
| 10 | class MiscHooks { |
| 11 | |
| 12 | /** |
| 13 | * Implements hook_views_data_alter(). |
| 14 | * |
| 15 | * @todo Remove once https://www.drupal.org/project/drupal/issues/2706431 is |
| 16 | * resolved. |
| 17 | */ |
| 18 | #[Hook('views_data_alter')] |
| 19 | public function viewsDataAlter(array &$data) { |
| 20 | $title = t('CRM User Sync Relation'); |
| 21 | $data['users_field_data']['crm_user_contact'] = [ |
| 22 | 'title' => $title, |
| 23 | 'help' => t('Adds relation to CRM User Sync Relation that point to current user.'), |
| 24 | 'relationship' => [ |
| 25 | 'base' => 'crm_user_contact', |
| 26 | 'base field' => 'user', |
| 27 | 'field' => 'uid', |
| 28 | 'id' => 'standard', |
| 29 | 'label' => $title, |
| 30 | ], |
| 31 | ]; |
| 32 | |
| 33 | $data['users_field_data']['crm_user_contact_sync_form'] = [ |
| 34 | 'title' => t('Contact relation'), |
| 35 | 'help' => t("Provides a link to the user's contact relation form."), |
| 36 | 'field' => [ |
| 37 | 'id' => 'crm_contact_user', |
| 38 | ], |
| 39 | ]; |
| 40 | $data['users_field_data']['crm_core_user_sync_form'] = [ |
| 41 | 'title' => t('Contact relation'), |
| 42 | 'help' => t("Provides a link to the user's contact relation form."), |
| 43 | 'field' => [ |
| 44 | 'id' => 'crm_user_contact', |
| 45 | ], |
| 46 | ]; |
| 47 | |
| 48 | $data['crm_contact']['crm_user_contact'] = [ |
| 49 | 'title' => $title, |
| 50 | 'help' => t('Adds relation to CRM User Sync Relation that point to current person.'), |
| 51 | 'relationship' => [ |
| 52 | 'base' => 'crm_user_contact', |
| 53 | 'base field' => 'crm_contact', |
| 54 | 'field' => 'id', |
| 55 | 'id' => 'standard', |
| 56 | 'label' => $title, |
| 57 | ], |
| 58 | ]; |
| 59 | |
| 60 | $data['crm_contact']['crm_core_user_sync_form'] = [ |
| 61 | 'title' => t('User relation'), |
| 62 | 'help' => t("Provides a link to the person's user relation form."), |
| 63 | 'field' => [ |
| 64 | 'id' => 'crm_user_contact', |
| 65 | 'field_name' => 'user', |
| 66 | ], |
| 67 | ]; |
| 68 | |
| 69 | } |
| 70 | |
| 71 | } |