class EntityTestViewBuilder
Same name in this branch
- 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestViewBuilder.php \Drupal\entity_test\Entity\EntityTestViewBuilder
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php \Drupal\entity_test\EntityTestViewBuilder
- 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestViewBuilder.php \Drupal\entity_test\Entity\EntityTestViewBuilder
Defines an entity view builder for a test entity.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\EntityViewBuilder extends \Drupal\Core\Entity\EntityHandlerInterface, \Drupal\Core\Entity\EntityViewBuilderInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Entity\EntityHandlerBase
- class \Drupal\entity_test\EntityTestViewBuilder implements \Drupal\Core\Entity\EntityViewBuilder
- class \Drupal\Core\Entity\EntityViewBuilder extends \Drupal\Core\Entity\EntityHandlerInterface, \Drupal\Core\Entity\EntityViewBuilderInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Entity\EntityHandlerBase
Expanded class hierarchy of EntityTestViewBuilder
See also
\Drupal\entity_test\Entity\EntityTestRender
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestViewBuilder.php, line 12
Namespace
Drupal\entity_testView source
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,
];
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.