EntityBrowserListBuilder.php in Entity Browser 8.2
File
src/Controllers/EntityBrowserListBuilder.php
View source
<?php
namespace Drupal\entity_browser\Controllers;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
class EntityBrowserListBuilder extends EntityListBuilder {
public function buildHeader() {
$header['id'] = $this
->t('ID');
$header['name'] = $this
->t('Name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['id'] = $entity
->id();
$row['name'] = $entity
->label();
return $row + parent::buildRow($entity);
}
protected function getDefaultOperations(EntityInterface $entity) {
if ($entity
->access('update')) {
$operations['edit'] = [
'title' => $this
->t('Edit'),
'url' => $entity
->toUrl('edit-form'),
];
}
$operations['edit-widgets'] = [
'title' => $this
->t('Edit Widgets'),
'url' => $entity
->toUrl('edit-widgets'),
];
if ($entity
->access('delete')) {
$operations['delete'] = [
'title' => $this
->t('Delete'),
'url' => $entity
->toUrl('delete-form'),
'weight' => 100,
];
}
return $operations;
}
}