function 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 '';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.