protected function LinkEdit::renderLink in Profile 2 8
Prepares the link to the profile.
Parameters
\Drupal\Core\Entity\EntityInterface $profile: The profile entity this field belongs to.
ResultRow $values: The values retrieved from the view's result set.
Return value
string Returns a string for the link text.
Overrides Link::renderLink
File
- src/
Plugin/ views/ field/ LinkEdit.php, line 33 - Definition of Drupal\profile\Plugin\views\field\LinkEdit.
Class
- LinkEdit
- Field handler to present a link profile edit.
Namespace
Drupal\profile\Plugin\views\fieldCode
protected function renderLink($profile, ResultRow $values) {
// Ensure user has access to edit this profile.
if (!$profile
->access('update')) {
return;
}
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "user/" . $profile
->getOwnerId() . "/edit/" . $profile
->bundle() . "/" . $profile
->id();
$this->options['alter']['query'] = drupal_get_destination();
$text = !empty($this->options['text']) ? $this->options['text'] : t('Edit');
return $text;
}