Backup of db before drupal security update
[yaffs-website] / web / core / modules / block_content / src / BlockContentListBuilder.php
1 <?php
2
3 namespace Drupal\block_content;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Entity\EntityListBuilder;
7 use Drupal\Core\Routing\RedirectDestinationTrait;
8
9 /**
10  * Defines a class to build a listing of custom block entities.
11  *
12  * @see \Drupal\block_content\Entity\BlockContent
13  */
14 class BlockContentListBuilder extends EntityListBuilder {
15
16   use RedirectDestinationTrait;
17
18   /**
19    * {@inheritdoc}
20    */
21   public function buildHeader() {
22     $header['label'] = t('Block description');
23     return $header + parent::buildHeader();
24   }
25
26   /**
27    * {@inheritdoc}
28    */
29   public function buildRow(EntityInterface $entity) {
30     $row['label'] = $entity->label();
31     return $row + parent::buildRow($entity);
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function getDefaultOperations(EntityInterface $entity) {
38     $operations = parent::getDefaultOperations($entity);
39     if (isset($operations['edit'])) {
40       $operations['edit']['query']['destination'] = $this->getRedirectDestination()->get();
41     }
42     return $operations;
43   }
44
45 }