You are here

public function CommentManagerInterface::forbiddenMessage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/CommentManagerInterface.php \Drupal\comment\CommentManagerInterface::forbiddenMessage()

Provides a message if posting comments is forbidden.

If authenticated users can post comments, a message is returned that prompts the anonymous user to log in (or register, if applicable) that redirects to entity comment form. Otherwise, no message is returned.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to which comments are attached to.

string $field_name: The field name on the entity to which comments are attached to.

Return value

string HTML for a "you can't post comments" notice.

1 method overrides CommentManagerInterface::forbiddenMessage()
CommentManager::forbiddenMessage in core/modules/comment/src/CommentManager.php
Provides a message if posting comments is forbidden.

File

core/modules/comment/src/CommentManagerInterface.php, line 67
Contains \Drupal\comment\CommentManagerInterface.

Class

CommentManagerInterface
Comment manager contains common functions to manage comment fields.

Namespace

Drupal\comment

Code

public function forbiddenMessage(EntityInterface $entity, $field_name);