sports_league-8.x-1.x-dev/modules/sl_standings/src/SLStandingsRostersTypeListBuilder.php
modules/sl_standings/src/SLStandingsRostersTypeListBuilder.php
<?php
declare(strict_types=1);
namespace Drupal\sl_standings;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Defines a class to build a listing of sl standings rosters type entities.
*
* @see \Drupal\sl_standings\Entity\SLStandingsRostersType
*/
final class SLStandingsRostersTypeListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader(): array {
$header['label'] = $this->t('Label');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity): array {
$row['label'] = $entity->label();
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
public function render(): array {
$build = parent::render();
$build['table']['#empty'] = $this->t(
'No sl standings rosters types available. <a href=":link">Add sl standings rosters type</a>.',
[':link' => Url::fromRoute('entity.sl_standings_rosters_type.add_form')->toString()],
);
return $build;
}
}
