EntityTestViewBuilderOverriddenView.php in Drupal 10
File
core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilderOverriddenView.php
View source
<?php
namespace Drupal\entity_test;
use Drupal\Core\Entity\EntityInterface;
class EntityTestViewBuilderOverriddenView extends EntityTestViewBuilder {
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
$build = [];
$build[$entity
->id()]['#plain_text'] = $entity
->label();
return $build;
}
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build = [];
foreach ($entities as $key => $entity) {
$build[$key] = $this
->view($entity, $view_mode, $langcode);
}
return $build;
}
}