3 namespace Drupal\comment;
5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
6 use Drupal\Core\Entity\EntityInterface;
9 * Defines a class to build a listing of comment type entities.
11 * @see \Drupal\comment\Entity\CommentType
13 class CommentTypeListBuilder extends ConfigEntityListBuilder {
18 public function getDefaultOperations(EntityInterface $entity) {
19 $operations = parent::getDefaultOperations($entity);
20 // Place the edit operation after the operations added by field_ui.module
21 // which have the weights 15, 20, 25.
22 if (isset($operations['edit'])) {
23 $operations['edit']['weight'] = 30;
31 public function buildHeader() {
32 $header['type'] = t('Comment type');
33 $header['description'] = t('Description');
34 return $header + parent::buildHeader();
40 public function buildRow(EntityInterface $entity) {
41 $row['type'] = $entity->label();
42 $row['description']['data'] = ['#markup' => $entity->getDescription()];
43 return $row + parent::buildRow($entity);