You are here

public function ImageThumbnail::view in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\ImageThumbnail::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/ImageThumbnail.php, line 64

Class

ImageThumbnail
Displays image thumbnail.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay

Code

public function view(EntityInterface $entity) {
  return [
    '#theme' => 'image_style',
    '#style_name' => $this->configuration['image_style'],
    '#title' => $entity
      ->label(),
    '#alt' => $entity
      ->label(),
    '#uri' => $entity
      ->getFileUri(),
  ];
}