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;
|
||||
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Web\Url;
|
||||
|
||||
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…
Reference in New Issue