You are here

function Username::render_link in Views (for Drupal 7) 8.3

1 call to Username::render_link()
Username::render in lib/Views/comment/Plugin/views/field/Username.php
Render the field.

File

lib/Views/comment/Plugin/views/field/Username.php, line 50
Definition of Views\comment\Plugin\views\field\Username.

Class

Username
Field handler to allow linking to a user account or homepage.

Namespace

Views\comment\Plugin\views\field

Code

function render_link($data, $values) {
  if (!empty($this->options['link_to_user'])) {
    $account = entity_create('user', array());
    $account->uid = $this
      ->get_value($values, 'uid');
    $account->name = $this
      ->get_value($values);
    $account->homepage = $this
      ->get_value($values, 'homepage');
    return theme('username', array(
      'account' => $account,
    ));
  }
  else {
    return $data;
  }
}