You are here

public static function Utility::setEntityRenderArray in AJAX Comments 8

Store a generated entity render array.

Parameters

array $build: The render array to store.

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity with the render array to store.

string $view_mode: The view mode of the render array.

1 call to Utility::setEntityRenderArray()
ajax_comments_entity_display_build_alter in ./ajax_comments.module
Implements hook_entity_display_build_alter().

File

src/Utility.php, line 39

Class

Utility
Provides various helper methods for Ajax Comments.

Namespace

Drupal\ajax_comments

Code

public static function setEntityRenderArray($build, ContentEntityInterface $entity, $view_mode = 'default') {
  $prefix = static::isAjaxRequest(\Drupal::request()) ? 'ajax' : 'standard';
  $entity_type = $entity
    ->getEntityTypeId();
  $bundle = $entity
    ->bundle();
  $id = $entity
    ->id();
  $key = $entity_type . '.' . $bundle . '.' . $view_mode . '.' . $id;
  static::$entityRenderArrays[$key] = $build;
}