CommentTypeListBuilder.php in Drupal 9
File
core/modules/comment/src/CommentTypeListBuilder.php
View source
<?php
namespace Drupal\comment;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class CommentTypeListBuilder extends ConfigEntityListBuilder {
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['weight'] = 30;
}
return $operations;
}
public function buildHeader() {
$header['type'] = t('Comment type');
$header['description'] = t('Description');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['type'] = $entity
->label();
$row['description']['data'] = [
'#markup' => $entity
->getDescription(),
];
return $row + parent::buildRow($entity);
}
}