You are here

public function LazyRenderer::getPost in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.0.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer::getPost()
  2. 10.1.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer::getPost()
  3. 10.2.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer::getPost()

Get post with specific view mode via lazy builder.

Parameters

string $entity_type: The entity type ID.

string|int $post_id: The post ID.

string $view_mode: The view mode.

Return value

array The render array of post.

File

modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php, line 45

Class

LazyRenderer
Provides lazy builder for content inside modal window.

Namespace

Drupal\social_post_album

Code

public function getPost($entity_type, $post_id, $view_mode) {
  $post = $this->entityTypeManager
    ->getStorage($entity_type)
    ->load($post_id);
  return $this->entityTypeManager
    ->getViewBuilder($entity_type)
    ->view($post, $view_mode);
}