mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 05:44:36 +02:00
NavigationItemForm: Strip the current base url from an item's url
This commit is contained in:
parent
eef4322188
commit
16cdd76c9e
@ -4,6 +4,7 @@
|
|||||||
namespace Icinga\Forms\Navigation;
|
namespace Icinga\Forms\Navigation;
|
||||||
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
class NavigationItemForm extends Form
|
class NavigationItemForm extends Form
|
||||||
{
|
{
|
||||||
@ -71,4 +72,20 @@ class NavigationItemForm extends Form
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getValues($suppressArrayNotation = false)
|
||||||
|
{
|
||||||
|
$values = parent::getValues($suppressArrayNotation);
|
||||||
|
if (isset($values['url']) && $values['url']) {
|
||||||
|
$url = Url::fromPath($values['url']);
|
||||||
|
if (! $url->isExternal() && ($relativePath = $url->getRelativeUrl())) {
|
||||||
|
$values['url'] = $relativePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user