function CommentManagerInterface::forbiddenMessage
Same name in other branches
- 9 core/modules/comment/src/CommentManagerInterface.php \Drupal\comment\CommentManagerInterface::forbiddenMessage()
- 8.9.x core/modules/comment/src/CommentManagerInterface.php \Drupal\comment\CommentManagerInterface::forbiddenMessage()
- 11.x 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.
File
-
core/
modules/ comment/ src/ CommentManagerInterface.php, line 60
Class
- CommentManagerInterface
- Comment manager contains common functions to manage comment fields.
Namespace
Drupal\commentCode
public function forbiddenMessage(EntityInterface $entity, $field_name);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.