You are here

public function Host::projectLink in http:BL 8

Creates a link to Project Honey Pot IP Address Inspector for a host entity.

Parameters

string $text: The link text.

Return value

string The formatted link.

Overrides HostInterface::projectLink

File

src/Entity/Host.php, line 130
Contains \Drupal\httpbl\Entity\Host.

Class

Host
Defines the host entity class.

Namespace

Drupal\httpbl\Entity

Code

public function projectLink($text = 'Project Honeypot') {
  $url = \Drupal\Core\Url::fromUri('http://www.projecthoneypot.org/search_ip.php?ip=' . $this
    ->getHostIp());
  $url_options = [
    'attributes' => [
      'target' => '_blank',
      'title' => t('Project Honey Pot IP Address Inspector.'),
    ],
  ];
  $url
    ->setOptions($url_options);
  return \Drupal\Core\Link::fromTextAndUrl(t($text), $url)
    ->toString();
}