cloud-8.x-2.0-beta1/modules/cloud_service_providers/openstack/src/InstanceListBuilder.php
modules/cloud_service_providers/openstack/src/InstanceListBuilder.php
<?php
namespace Drupal\openstack;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of OpenStack Cloud Instance entities.
*
* @ingroup openstack
*/
class InstanceListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('OpenStack Cloud Instance ID');
$header['name'] = $this->t('Name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var \Drupal\openstack\Entity\Instance $entity */
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.openstack_cloud_instance.edit_form',
[
'openstack_cloud_instance' => $entity->id(),
'cloud_context' => $entity->getCloudContext(),
]
);
return $row + parent::buildRow($entity);
}
}
