function EntityLink::getUrlInfo

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/EntityLink.php \Drupal\views\Plugin\views\field\EntityLink::getUrlInfo()
  2. 8.9.x core/modules/views/src/Plugin/views/field/EntityLink.php \Drupal\views\Plugin\views\field\EntityLink::getUrlInfo()
  3. 11.x core/modules/views/src/Plugin/views/field/EntityLink.php \Drupal\views\Plugin\views\field\EntityLink::getUrlInfo()

Overrides LinkBase::getUrlInfo

1 call to EntityLink::getUrlInfo()
EntityLink::renderLink in core/modules/views/src/Plugin/views/field/EntityLink.php
Prepares the link to view an entity.

File

core/modules/views/src/Plugin/views/field/EntityLink.php, line 38

Class

EntityLink
Field handler to present a link to an entity.

Namespace

Drupal\views\Plugin\views\field

Code

protected function getUrlInfo(ResultRow $row) {
    $template = $this->getEntityLinkTemplate();
    $entity = $this->getEntity($row);
    if ($entity === NULL) {
        return NULL;
    }
    if ($this->languageManager
        ->isMultilingual()) {
        $entity = $this->getEntityTranslationByRelationship($entity, $row);
    }
    return $entity->toUrl($template)
        ->setAbsolute($this->options['absolute']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.