3 namespace Drupal\views\Plugin\views\field;
5 use Drupal\views\ResultRow;
8 * Field handler to present a link to an entity.
10 * @ingroup views_field_handlers
12 * @ViewsField("entity_link")
14 class EntityLink extends LinkBase {
19 public function render(ResultRow $row) {
20 return $this->getEntity($row) ? parent::render($row) : [];
26 protected function getUrlInfo(ResultRow $row) {
27 $template = $this->getEntityLinkTemplate();
28 return $this->getEntity($row)->urlInfo($template);
32 * Returns the entity link template name identifying the link route.
35 * The link template name.
37 protected function getEntityLinkTemplate() {
44 protected function getDefaultLabel() {
45 return $this->t('view');