function Username::render_link

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

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php, line 50
Definition of Drupal\comment\Plugin\views\field\Username.

Class

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

Namespace

Drupal\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;
  }
}