function EntityTestExternal::toUrl

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestExternal.php \Drupal\entity_test\Entity\EntityTestExternal::toUrl()
  2. 8.9.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestExternal.php \Drupal\entity_test\Entity\EntityTestExternal::toUrl()
  3. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestExternal.php \Drupal\entity_test\Entity\EntityTestExternal::toUrl()

Overrides EntityBase::toUrl

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestExternal.php, line 29

Class

EntityTestExternal
Test entity class.

Namespace

Drupal\entity_test\Entity

Code

public function toUrl($rel = NULL, array $options = []) {
  if ($rel === 'canonical') {
    return Url::fromUri('http://example.com', $options);
  }
  return parent::toUrl($rel, $options);
}

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