function Comment::getDefaultStatus
Same name in other branches
- 9 core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getDefaultStatus()
- 8.9.x core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getDefaultStatus()
- 11.x core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getDefaultStatus()
Default value callback for 'status' base field definition.
Return value
bool TRUE if the comment should be published, FALSE otherwise.
See also
::baseFieldDefinitions()
File
-
core/
modules/ comment/ src/ Entity/ Comment.php, line 542
Class
- Comment
- Defines the comment entity class.
Namespace
Drupal\comment\EntityCode
public static function getDefaultStatus() {
return \Drupal::currentUser()->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.