public function EntityLabel::view in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/Plugin/EntityBrowser/FieldWidgetDisplay/EntityLabel.php \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\EntityLabel::view()
Builds and gets render array for the entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity to be displayed.
Return value
array Render array that is to be used to display the entity in field widget.
Overrides FieldWidgetDisplayInterface::view
File
- src/
Plugin/ EntityBrowser/ FieldWidgetDisplay/ EntityLabel.php, line 62
Class
- EntityLabel
- Displays a label of the entity.
Namespace
Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplayCode
public function view(EntityInterface $entity) {
$translation = $this->entityRepository
->getTranslationFromContext($entity);
return $translation
->label();
}