Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityBase.php

function EntityBase::toLink

Overrides EntityInterface::toLink

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 255

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function toLink($text = NULL, $rel = 'canonical', array $options = []) {
    if (!isset($text)) {
        $text = $this->label();
    }
    $url = $this->toUrl($rel);
    $options += $url->getOptions();
    $url->setOptions($options);
    return new Link($text, $url);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal