You are here

protected function VisitorsBlock::_showUserIp in Visitors 8.2

Display user ip to visitors block.

1 call to VisitorsBlock::_showUserIp()
VisitorsBlock::build in src/Plugin/Block/VisitorsBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/VisitorsBlock.php, line 143
Contains \Drupal\visitors\Plugin\Block\VisitorsBlock.

Class

VisitorsBlock
Provides a 'Visitors' block.

Namespace

Drupal\visitors\Plugin\Block

Code

protected function _showUserIp() {
  if ($this->config
    ->get('show_user_ip')) {
    $this->items[] = t('Your IP: %user_ip', array(
      '%user_ip' => \Drupal::request()
        ->getClientIp(),
    ));
  }
}