Issue #3409895 by acbramley, longwave, smustgrave: [regression] toUrl can...
Issue #3409895 by acbramley, longwave, smustgrave: [regression] toUrl can incorrectly return edit-form url when another link template shares the canonical url
(cherry picked from commit 9231c9cf)
9 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
@@ -167,12 +167,13 @@ public function toUrl($rel = NULL, array $options = []) {
// Use the canonical link template by default, or edit-form if there is not
// a canonical one.
if($rel===NULL){
$rel_candidates=array_intersect(
['canonical','edit-form'],
array_flip($link_templates),
);
$rel=array_shift($rel_candidates);
if($rel===NULL){
if(isset($link_templates['canonical'])){
$rel='canonical';
}
elseif(isset($link_templates['edit-form'])){
$rel='edit-form';
}
else{
thrownewUndefinedLinkTemplateException("Cannot generate default URL because no link template 'canonical' or 'edit-form' was found for the '{$this->getEntityTypeId()}' entity type");
$this->expectExceptionMessage("Cannot generate default URL because no link template 'canonical' or 'edit-form' was found for the '".$this->entityTypeId."' entity type");
$entity->toUrl();
}
/**
* Tests the toUrl() method without specifying the $rel parameter.
*
* It should return the edit-form or canonical link templates by default if