EntityTestViewBuilder.php
Same filename in this branch
Same filename in other branches
- 8.9.x core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
- 8.9.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestViewBuilder.php
- 10 core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
- 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestViewBuilder.php
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
- 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestViewBuilder.php
Namespace
Drupal\entity_testFile
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestViewBuilder.php
View source
<?php
namespace Drupal\entity_test;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* Defines an entity view builder for a test entity.
*
* @see \Drupal\entity_test\Entity\EntityTestRender
*/
class EntityTestViewBuilder extends EntityViewBuilder {
/**
* {@inheritdoc}
*/
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'] = [
'#weight' => -100,
'#plain_text' => $entity->label(),
];
$build[$id]['separator'] = [
'#weight' => -150,
'#markup' => ' | ',
];
$build[$id]['view_mode'] = [
'#weight' => -200,
'#plain_text' => $view_mode,
];
}
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
EntityTestViewBuilder | Defines an entity view builder for a test entity. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.