class LazyRenderer in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer
- 10.1.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer
- 10.2.x modules/social_features/social_post/modules/social_post_album/src/LazyRenderer.php \Drupal\social_post_album\LazyRenderer
Provides lazy builder for content inside modal window.
@package Drupal\social_post_album
Hierarchy
- class \Drupal\social_post_album\LazyRenderer implements TrustedCallbackInterface
Expanded class hierarchy of LazyRenderer
1 string reference to 'LazyRenderer'
- social_post_album.services.yml in modules/
social_features/ social_post/ modules/ social_post_album/ social_post_album.services.yml - modules/social_features/social_post/modules/social_post_album/social_post_album.services.yml
1 service uses LazyRenderer
- social_post_album.lazy_renderer in modules/
social_features/ social_post/ modules/ social_post_album/ social_post_album.services.yml - Drupal\social_post_album\LazyRenderer
File
- modules/
social_features/ social_post/ modules/ social_post_album/ src/ LazyRenderer.php, line 13
Namespace
Drupal\social_post_albumView source
class LazyRenderer implements TrustedCallbackInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* LazyRenderer constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* Get post with specific view mode via lazy builder.
*
* @param string $entity_type
* The entity type ID.
* @param string|int $post_id
* The post ID.
* @param string $view_mode
* The view mode.
*
* @return array
* The render array of post.
*/
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);
}
/**
* {@inheritdoc}
*/
public static function trustedCallbacks() {
return [
'getPost',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LazyRenderer:: |
protected | property | The entity type manager. | |
LazyRenderer:: |
public | function | Get post with specific view mode via lazy builder. | |
LazyRenderer:: |
public static | function |
Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface:: |
|
LazyRenderer:: |
public | function | LazyRenderer constructor. | |
TrustedCallbackInterface:: |
constant | Untrusted callbacks throw exceptions. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger E_USER_WARNING errors. |