You are here

public function MediaEntityRenderer::render in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/MediaEntityRenderer.php \Drupal\gutenberg\MediaEntityRenderer::render()

Render media entities.

Parameters

\Drupal\media\Entity\Media|string $media_entity: Media entity ID or loaded media entity instance.

string $view_mode: (optional) View mode of media entity, 'full' is default.

Return value

string Rendered HTML of the media entity.

Overrides MediaEntityRendererInterface::render

File

src/MediaEntityRenderer.php, line 47

Class

MediaEntityRenderer
Renders media entities to the HTML.

Namespace

Drupal\gutenberg

Code

public function render($media_entity, string $view_mode = 'full') {
  $render_array = $this
    ->renderArray($media_entity, $view_mode);
  return (string) $this->renderer
    ->render($render_array);
}