You are here

public function UnitViewsData::getViewsData in Booking and Availability Management Tools for Drupal 8

Returns views data for the entity type.

Return value

array Views data in the format of hook_views_data().

Overrides EntityViewsData::getViewsData

File

modules/bat_unit/src/Entity/UnitViewsData.php, line 21
Contains \Drupal\bat_unit\Entity\UnitViewsData.

Class

UnitViewsData
Provides Views data for Unit entities.

Namespace

Drupal\bat_unit\Entity

Code

public function getViewsData() {
  $data = parent::getViewsData();
  $data['unit']['table']['base'] = [
    'field' => 'id',
    'title' => $this
      ->t('Unit'),
    'help' => $this
      ->t('The Unit ID.'),
  ];
  $data['unit']['type']['field'] = [
    'title' => t('Booking Unit Bundle'),
    'help' => t('Booking Unit Bundle Label.'),
    'id' => 'bat_unit_handler_unit_bundle_field',
  ];
  $data['unit']['unit_bulk_form'] = [
    'title' => t('Unit operations bulk form'),
    'help' => t('Add a form element that lets you run operations on multiple units.'),
    'field' => [
      'id' => 'unit_bulk_form',
    ],
  ];
  $data['unit']['unit_type_id']['filter']['id'] = 'bat_unit_handler_type_id_filter';
  return $data;
}