Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / comment / src / CommentTypeListBuilder.php
1 <?php
2
3 namespace Drupal\comment;
4
5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
6 use Drupal\Core\Entity\EntityInterface;
7
8 /**
9  * Defines a class to build a listing of comment type entities.
10  *
11  * @see \Drupal\comment\Entity\CommentType
12  */
13 class CommentTypeListBuilder extends ConfigEntityListBuilder {
14
15   /**
16    * {@inheritdoc}
17    */
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;
24     }
25     return $operations;
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function buildHeader() {
32     $header['type'] = t('Comment type');
33     $header['description'] = t('Description');
34     return $header + parent::buildHeader();
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   public function buildRow(EntityInterface $entity) {
41     $row['type'] = $entity->label();
42     $row['description']['data'] = ['#markup' => $entity->getDescription()];
43     return $row + parent::buildRow($entity);
44   }
45
46 }