class CommentLazyBuilders implements TrustedCallbackInterface (View source)

Defines a service for comment #lazy_builder callbacks.

Traits

Provides a standard way to announce deprecated properties.

Properties

protected $deprecatedProperties {@inheritdoc}
protected EntityTypeManagerInterface $entityTypeManager

The entity type manager service.

protected EntityFormBuilderInterface $entityFormBuilder

The entity form builder service.

protected CommentManagerInterface $commentManager

Comment manager service.

protected AccountInterface $currentUser

Current logged in user.

protected ModuleHandlerInterface $moduleHandler

The module handler service.

protected RendererInterface $renderer

The renderer service.

Methods

__get($name)

Allows to access deprecated/removed properties.

__construct(EntityTypeManagerInterface $entity_type_manager, EntityFormBuilderInterface $entity_form_builder, AccountInterface $current_user, CommentManagerInterface $comment_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer)

Constructs a new CommentLazyBuilders object.

array
renderForm(string $commented_entity_type_id, string $commented_entity_id, string $field_name, string $comment_type_id)

lazy_builder callback; builds the comment form.

array
renderLinks(string $comment_entity_id, string $view_mode, string $langcode, bool $is_in_preview)

lazy_builder callback; builds a comment's links.

array
buildLinks(CommentInterface $entity, EntityInterface $commented_entity)

Build the default links (reply, edit, delete …) for a comment.

access(EntityInterface $entity)

Wraps content_translation_translate_access.

static string[]
trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

Details

__get($name)

Allows to access deprecated/removed properties.

This method must be public.

Parameters

$name

__construct(EntityTypeManagerInterface $entity_type_manager, EntityFormBuilderInterface $entity_form_builder, AccountInterface $current_user, CommentManagerInterface $comment_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer)

Constructs a new CommentLazyBuilders object.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager service.

EntityFormBuilderInterface $entity_form_builder

The entity form builder service.

AccountInterface $current_user

The current logged in user.

CommentManagerInterface $comment_manager

The comment manager service.

ModuleHandlerInterface $module_handler

The module handler service.

RendererInterface $renderer

The renderer service.

array renderForm(string $commented_entity_type_id, string $commented_entity_id, string $field_name, string $comment_type_id)

lazy_builder callback; builds the comment form.

Parameters

string $commented_entity_type_id

The commented entity type ID.

string $commented_entity_id

The commented entity ID.

string $field_name

The comment field name.

string $comment_type_id

The comment type ID.

Return Value

array

A renderable array containing the comment form.

lazy_builder callback; builds a comment's links.

Parameters

string $comment_entity_id

The comment entity ID.

string $view_mode

The view mode in which the comment entity is being viewed.

string $langcode

The language in which the comment entity is being viewed.

bool $is_in_preview

Whether the comment is currently being previewed.

Return Value

array

A renderable array representing the comment links.

Build the default links (reply, edit, delete …) for a comment.

Parameters

CommentInterface $entity

The comment object.

EntityInterface $commented_entity

The entity to which the comment is attached.

Return Value

array

An array that can be processed by drupal_pre_render_links().

protected access(EntityInterface $entity)

Wraps content_translation_translate_access.

Parameters

EntityInterface $entity

static string[] trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

Trusted callbacks are public methods on the implementing class and can be invoked via \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback().

Return Value

string[]

List of method names implemented by the class that can be used as trusted callbacks.