diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index a9ad3ad..add9830 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -395,27 +395,6 @@ public function toUrl($rel = 'edit-form', array $options = []) { /** * {@inheritdoc} */ - public function url($rel = 'edit-form', $options = array()) { - return parent::url($rel, $options); - } - - /** - * {@inheritdoc} - */ - public function link($text = NULL, $rel = 'edit-form', array $options = []) { - return parent::link($text, $rel, $options); - } - - /** - * {@inheritdoc} - */ - public function toLink($text = NULL, $rel = 'edit-form', array $options = []) { - return parent::toLink($text, $rel, $options); - } - - /** - * {@inheritdoc} - */ public function getCacheTagsToInvalidate() { // Use cache tags that match the underlying config object's name. // @see \Drupal\Core\Config\ConfigBase::getCacheTags() diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index feb8108..8164d7c 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -266,7 +266,7 @@ public function link($text = NULL, $rel = 'canonical', array $options = []) { * {@inheritdoc} */ public function toLink($text = NULL, $rel = 'canonical', array $options = []) { - if (is_null($text)) { + if (!isset($text)) { $text = $this->label(); } $url = $this->toUrl($rel); @@ -279,9 +279,9 @@ public function toLink($text = NULL, $rel = 'canonical', array $options = []) { * {@inheritdoc} */ public function url($rel = 'canonical', $options = array()) { - // While self::urlInfo() will throw an exception if the entity is new, + // While self::toUrl() will throw an exception if the entity has no id, // the expected result for a URL is always a string. - if ($this->isNew() || !$this->hasLinkTemplate($rel)) { + if ($this->id() === NULL || !$this->hasLinkTemplate($rel)) { return ''; } diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index b900add..239c203 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -101,26 +101,10 @@ public function bundle(); public function label(); /** - * Deprecated alias for toUrl(). + * Gets the URL object for the entity. * - * @param string $rel - * The link relationship type, for example: canonical or edit-form. - * @param array $options - * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for - * the available options. - * - * @return \Drupal\Core\Url - * - * @deprecated in Drupal 8.0.0, intended to be removed in Drupal 9.0.0 - * Use toUrl() instead; it takes the same parameters and provides the same - * return value. - * - * @see \Drupal\Core\Entity\EntityInterface::toUrl - */ - public function urlInfo($rel = 'canonical', array $options = array()); - - /** - * Gets the URI elements of the entity. + * The entity must have an id already. Content entities usually get their IDs + * by saving them. * * URI templates might be set in the links array in an annotation, for * example: @@ -147,6 +131,7 @@ public function urlInfo($rel = 'canonical', array $options = array()); * the available options. * * @return \Drupal\Core\Url + * The URL object. * * @throws \Drupal\Core\Entity\EntityMalformedException * @throws \Drupal\Core\Entity\Exception\UndefinedLinkTemplateException @@ -154,10 +139,7 @@ public function urlInfo($rel = 'canonical', array $options = array()); public function toUrl($rel = 'canonical', array $options = array()); /** - * Deprecated way of getting the public URL for this entity. - * - * This is a wrapper around toUrl() that returns an empty string - * if the entity is not fully set up. Please use toUrl() directly. + * Gets the public URL for this entity. * * @param string $rel * The link relationship type, for example: canonical or edit-form. @@ -169,8 +151,7 @@ public function toUrl($rel = 'canonical', array $options = array()); * The URL for this entity. * * @deprecated in Drupal 8.0.0, intended to be removed in Drupal 9.0.0 - * Please use toUrl() instead. Note that toUrl() requires the entity to be - * fully set up, or it may throw an exception. + * Please use toUrl() instead. * * @see \Drupal\Core\Entity\EntityInterface::toUrl */ @@ -192,8 +173,7 @@ public function url($rel = 'canonical', $options = array()); * An HTML string containing a link to the entity. * * @deprecated in Drupal 8.0.0, intended to be removed in Drupal 9.0.0 - * Please use toLink() instead, but note that toLink() returns a - * \Drupal\Core\Link instead of a string. + * Please use toLink() instead. * * @see \Drupal\Core\Entity\EntityInterface::toLink */