You are here

public function PostViewBuilder::buildComponents in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  2. 8.2 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  3. 8.3 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  4. 8.4 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  5. 8.5 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  6. 8.6 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  7. 8.7 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  8. 8.8 modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  9. 10.3.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  10. 10.0.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  11. 10.1.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()
  12. 10.2.x modules/social_features/social_post/src/PostViewBuilder.php \Drupal\social_post\PostViewBuilder::buildComponents()

Builds the component fields and properties of a set of entities.

Parameters

&$build: The renderable array representing the entity content.

\Drupal\Core\Entity\EntityInterface[] $entities: The entities whose content is being built.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface[] $displays: The array of entity view displays holding the display options configured for the entity components, keyed by bundle name.

string $view_mode: The view mode in which the entity is being viewed.

Overrides EntityViewBuilder::buildComponents

File

modules/social_features/social_post/src/PostViewBuilder.php, line 16

Class

PostViewBuilder
Render controller for posts.

Namespace

Drupal\social_post

Code

public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
  if (empty($entities)) {
    return;
  }
  parent::buildComponents($build, $entities, $displays, $view_mode);
  foreach ($entities as $id => $entity) {
    $build[$id]['links'] = [
      '#lazy_builder' => [
        get_called_class() . '::renderLinks',
        [
          $entity
            ->id(),
          $view_mode,
          $entity
            ->language()
            ->getId(),
          !empty($entity->in_preview),
        ],
      ],
    ];
  }
}