learnosity-1.0.x-dev/src/LearnosityActivityPlayerListBuilder.php
src/LearnosityActivityPlayerListBuilder.php
<?php
namespace Drupal\learnosity;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
/**
* Provides a listing of Activity type entities.
*/
class LearnosityActivityPlayerListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['label'] = $this->t('Name');
$header['description'] = $this->t('Description');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
$row['description']['data'] = ['#markup' => $entity->getDescription()];
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity) {
/** @var \Drupal\field\FieldConfigInterface $entity */
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['weight'] = 30;
}
return $operations;
}
}
