FieldCollectionListBuilder.php in Field collection 8
File
src/FieldCollectionListBuilder.php
View source
<?php
namespace Drupal\field_collection;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class FieldCollectionListBuilder extends ConfigEntityListBuilder {
public function buildRow(EntityInterface $entity) {
$row['title'] = [
'data' => $entity
->label(),
'class' => [
'menu-label',
],
];
return $row + parent::buildRow($entity);
}
public function buildHeader() {
$header = [
'title' => $this
->t('Machine name'),
];
return $header + parent::buildHeader();
}
public function getDefaultOperations(EntityInterface $entity) {
return [];
}
public function render() {
$build = parent::render();
$build['#empty'] = t('No field collections have been defined yet. To do so attach a field collection field to any entity.');
return $build;
}
}