function ContactLink::getUrlInfo

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

Returns the URI elements of the link.

Parameters

\Drupal\views\ResultRow $row: A view result row.

Return value

\Drupal\Core\Url|null The URI elements of the link.

Overrides LinkBase::getUrlInfo

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

File

core/modules/contact/src/Plugin/views/field/ContactLink.php, line 32

Class

ContactLink
Defines a field that links to the user contact page, if access is permitted.

Namespace

Drupal\contact\Plugin\views\field

Code

protected function getUrlInfo(ResultRow $row) {
  $entity = $this->getEntity($row);
  if (!$entity) {
    return NULL;
  }
  return Url::fromRoute('entity.user.contact_form', [
    'user' => $entity->id(),
  ]);
}

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