Commit 4440d95b authored by webchick's avatar webchick

Issue #2257229 by marcingy | alasda: Cannot add external url or <front> as menu item.

parent 39d126b2
......@@ -524,7 +524,7 @@ public function preSave(EntityStorageInterface $storage) {
}
// Find the route_name.
if (!isset($this->route_name)) {
if (!$this->external && !isset($this->route_name)) {
$url = Url::createFromPath($this->link_path);
$this->route_name = $url->getRouteName();
$this->route_parameters = $url->getRouteParameters();
......
......@@ -395,6 +395,19 @@ function doMenuTests() {
// Verify in the database.
$this->assertMenuLink($item1['mlid'], array('hidden' => 0));
// Add an external link.
$item7 = $this->addMenuLink(0, 'http://drupal.org', $menu_name);
$this->assertMenuLink($item7['mlid'], array('link_path' => 'http://drupal.org', 'external' => 1));
// Add <front> menu item.
$item8 = $this->addMenuLink(0, '<front>', $menu_name);
$this->assertMenuLink($item8['mlid'], array('link_path' => '<front>', 'external' => 1));
$this->drupalGet('');
$this->assertResponse(200);
// Make sure we get routed correctly.
$this->clickLink($item8['link_title']);
$this->assertResponse(200);
// Save menu links for later tests.
$this->items[] = $item1;
$this->items[] = $item2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment