NavigationItemForm: Don't bypass Url's own optimisations when saving urls
refs #12133
This commit is contained in:
parent
4a791e6204
commit
da2940a811
|
@ -99,8 +99,10 @@ class NavigationItemForm extends Form
|
||||||
$values = parent::getValues($suppressArrayNotation);
|
$values = parent::getValues($suppressArrayNotation);
|
||||||
if (isset($values['url']) && $values['url']) {
|
if (isset($values['url']) && $values['url']) {
|
||||||
$url = Url::fromPath($values['url']);
|
$url = Url::fromPath($values['url']);
|
||||||
if (! $url->isExternal() && ($relativePath = $url->getRelativeUrl())) {
|
if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
|
||||||
$values['url'] = $relativePath;
|
$values['url'] = $url->getRelativeUrl();
|
||||||
|
} else {
|
||||||
|
$values['url'] = $url->getAbsoluteUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue