You are here

public function SmsMessageViewsData::getViewsData in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Views/SmsMessageViewsData.php \Drupal\sms\Views\SmsMessageViewsData::getViewsData()
  2. 2.1.x src/Views/SmsMessageViewsData.php \Drupal\sms\Views\SmsMessageViewsData::getViewsData()

Returns views data for the entity type.

Return value

array Views data in the format of hook_views_data().

Overrides EntityViewsData::getViewsData

File

src/Views/SmsMessageViewsData.php, line 15

Class

SmsMessageViewsData
Provides views data for SMS message entities.

Namespace

Drupal\sms\Views

Code

public function getViewsData() {
  $data = parent::getViewsData();

  // Direction field.
  $data['sms']['direction']['field']['id'] = 'sms_message_direction';

  // Recipient phone numbers.
  $data['sms__recipient_phone_number']['table']['join'] = [
    'sms' => [
      'left_field' => 'id',
      'field' => 'entity_id',
    ],
  ];
  $data['sms__recipient_phone_number']['table']['group'] = $this
    ->t('SMS Message');
  $data['sms__recipient_phone_number']['table']['provider'] = $this->entityType
    ->getProvider();
  return $data;
}