CommentManagerInterface::forbiddenMessage

public CommentManagerInterface::forbiddenMessage(EntityInterface $entity, $field_name)

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.

File

core/modules/comment/src/CommentManagerInterface.php, line 62

Class

CommentManagerInterface
Comment manager contains common functions to manage comment fields.

Namespace

Drupal\comment

Code

public function forbiddenMessage(EntityInterface $entity, $field_name);
doc_Drupal
2016-10-29 08:50:55
Comments
Leave a Comment

Please login to continue.