function EntityLabel::render

File

src/Plugin/views/field/EntityLabel.php, line 41

Class

EntityLabel
Field handler which shows the label for a job or job item.

Namespace

Drupal\tmgmt\Plugin\views\field

Code

function render(ResultRow $values) {
  if ($this
    ->getValue($values) && ($entity = $this
    ->getEntity($values))) {
    if (!empty($this->options['link_to_entity'])) {
      $this->options['alter']['url'] = $entity
        ->toUrl();
      $this->options['alter']['make_link'] = TRUE;
    }
    return $this
      ->sanitizeValue($entity
      ->label());
  }
}