public static function Comment::getDefaultHostname in Drupal 9
Same name and namespace in other branches
- 8 core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getDefaultHostname()
Returns the default value for entity hostname base field.
Return value
string The client host name.
File
- core/
modules/ comment/ src/ Entity/ Comment.php, line 552
Class
- Comment
- Defines the comment entity class.
Namespace
Drupal\comment\EntityCode
public static function getDefaultHostname() {
if (\Drupal::config('comment.settings')
->get('log_ip_addresses')) {
return \Drupal::request()
->getClientIP();
}
return '';
}