You are here

function Long2IpField::render in IP address manager 8.2

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides FieldPluginBase::render

File

src/Plugin/views/field/Long2IpField.php, line 24
Contains \Drupal\ip\Plugin\views\field\Long2IpField.

Class

Long2IpField
Render a long field as a ip value

Namespace

Drupal\ip\Plugin\views\field

Code

function render(ResultRow $values) {
  $value = $this
    ->getValue($values);
  $long2ip = !empty($value) ? long2ip($value) : NULL;

  // @TODO: fix path

  //$url = new Url('admin/people/ip', array('query' => array('ip' => array('value' => $long2ip))));

  //$external_link = \Drupal::l(t('External link'), $url);
  $external_link = $long2ip;

  // @TODO: link!
  return !empty($long2ip) ? $external_link : NULL;
}