LazyRenderer.php in Open Social 10.3.x
File
modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php
View source
<?php
namespace Drupal\social_post_album;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Security\TrustedCallbackInterface;
class LazyRenderer implements TrustedCallbackInterface {
protected $entityTypeManager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
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);
}
public static function trustedCallbacks() {
return [
'getPost',
];
}
}
Classes
Name |
Description |
LazyRenderer |
Provides lazy builder for content inside modal window. |