cloud-8.x-2.0-beta1/modules/cloud_service_providers/openstack/src/Entity/InstanceViewsData.php
modules/cloud_service_providers/openstack/src/Entity/InstanceViewsData.php
<?php
namespace Drupal\openstack\Entity;
use Drupal\aws_cloud\Entity\Ec2\AwsCloudViewsData;
/**
* Provides Views data for OpenStack Cloud Instance entities.
*/
class InstanceViewsData extends AwsCloudViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
$table_name = $this->storage->getEntityTypeId();
$fields = $this->entityManager->getFieldStorageDefinitions($table_name);
// The following is a list of fields to turn from text search to
// select list. This list can be expanded through hook_views_data_alter().
$selectable = [
'instance_state',
'instance_type',
'availability_zone',
'key_pair_name',
'image_id',
];
// Add an access query tag.
$data[$table_name]['table']['base']['access query tag'] = 'openstack_cloud_instance_views_access';
$this->addDropdownSelector($data, $table_name, $fields, $selectable);
return $data;
}
}
