Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ContactViewsData | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| getViewsData | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\crm; |
| 6 | |
| 7 | use Drupal\views\EntityViewsData; |
| 8 | |
| 9 | /** |
| 10 | * Provides Views data for the CRM Contact entity. |
| 11 | */ |
| 12 | class ContactViewsData extends EntityViewsData { |
| 13 | |
| 14 | /** |
| 15 | * {@inheritdoc} |
| 16 | */ |
| 17 | public function getViewsData(): array { |
| 18 | $data = parent::getViewsData(); |
| 19 | |
| 20 | if (isset($data['crm_contact__relationship_statistics'])) { |
| 21 | $data['crm_contact__relationship_statistics']['relationship_statistics_value']['title'] = $this->t('Relationship Type'); |
| 22 | $data['crm_contact__relationship_statistics']['relationship_statistics_value']['help'] = $this->t('The relationship type key.'); |
| 23 | $data['crm_contact__relationship_statistics']['relationship_statistics_value']['filter'] = [ |
| 24 | 'id' => 'crm_relationship_statistics_type', |
| 25 | ]; |
| 26 | |
| 27 | $data['crm_contact__relationship_statistics']['relationship_statistics_count']['title'] = $this->t('Relationship Count'); |
| 28 | $data['crm_contact__relationship_statistics']['relationship_statistics_count']['help'] = $this->t('The number of relationships of this type.'); |
| 29 | $data['crm_contact__relationship_statistics']['relationship_statistics_count']['field'] = [ |
| 30 | 'id' => 'crm_relationship_statistics', |
| 31 | ]; |
| 32 | $data['crm_contact__relationship_statistics']['relationship_statistics_count']['sort'] = [ |
| 33 | 'id' => 'crm_relationship_statistics_count', |
| 34 | ]; |
| 35 | } |
| 36 | |
| 37 | return $data; |
| 38 | } |
| 39 | |
| 40 | } |