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