fe7d7c32e1a956cf6d93596d59fc0b285f610f3f
[yaffs-website] / web / modules / contrib / entity_browser / src / Controllers / EntityBrowserListBuilder.php
1 <?php
2
3 namespace Drupal\entity_browser\Controllers;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Entity\EntityListBuilder;
7
8 /**
9  * Provides a list controller for entity browser.
10  *
11  * @ingroup entity_browser
12  */
13 class EntityBrowserListBuilder extends EntityListBuilder {
14
15   /**
16    * {@inheritdoc}
17    *
18    * Building the header and content lines for the entity browser list.
19    *
20    * Calling the parent::buildHeader() adds a column for the possible actions
21    * and inserts the 'edit' and 'delete' links as defined for the entity type.
22    */
23   public function buildHeader() {
24     $header['id'] = $this->t('ID');
25     $header['name'] = $this->t('Name');
26     return $header + parent::buildHeader();
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   public function buildRow(EntityInterface $entity) {
33     /* @var $entity \Drupal\entity_browser\Entity\EntityBrowser */
34     $row['id'] = $entity->id();
35     $row['name'] = $entity->label();
36     return $row + parent::buildRow($entity);
37   }
38
39 }