EntityTestViewBuilder.php in Zircon Profile 8.0
File
core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
View source
<?php
namespace Drupal\entity_test;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
class EntityTestViewBuilder extends EntityViewBuilder {
protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
$build = parent::getBuildDefaults($entity, $view_mode);
unset($build['#theme']);
return $build;
}
public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
parent::buildComponents($build, $entities, $displays, $view_mode);
foreach ($entities as $id => $entity) {
$build[$id]['label'] = array(
'#weight' => -100,
'#plain_text' => $entity
->label(),
);
$build[$id]['separator'] = array(
'#weight' => -150,
'#markup' => ' | ',
);
$build[$id]['view_mode'] = array(
'#weight' => -200,
'#plain_text' => $view_mode,
);
}
}
}