GoogleApiClientListBuilder.php in Google API PHP Client 8.2
File
src/Entity/Controller/GoogleApiClientListBuilder.php
View source
<?php
namespace Drupal\google_api_client\Entity\Controller;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
class GoogleApiClientListBuilder extends EntityListBuilder {
public function render() {
$build['description'] = [
'#markup' => $this
->t('GoogleApiClient implements a GoogleApiClient account model. These google_api_client accounts are fieldable entities. You can manage the fields on the <a href="@adminlink">GoogleApiClient admin page</a>.', [
'@adminlink' => \Drupal::urlGenerator()
->generateFromRoute('google_api_client.google_api_client_settings'),
]),
];
$build += parent::render();
return $build;
}
public function buildHeader() {
$header = [
'Id',
'Name',
'Services',
'Is Authenticated',
'Created By',
];
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row = [
'id' => $entity
->getId(),
'Name' => $entity
->getName(),
'Services' => implode(", ", _google_api_client_google_services_names($entity
->getServices())),
'is_authenticated' => $entity
->getAuthenticated() ? t('Yes') : t('No'),
'Created By' => $entity
->getOwner()
->toLink($entity
->getOwner()
->getAccountName()),
];
return $row + parent::buildRow($entity);
}
}