Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentManagerInterface.php

function 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\comment

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal