diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 8a4d756..b8fcdeb 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -354,11 +354,19 @@ public function toString() { * An associative array containing all the properties of the route. */ public function toArray() { - return array( - 'route_name' => $this->getRouteName(), - 'route_parameters' => $this->getRouteParameters(), - 'options' => $this->getOptions(), - ); + if ($this->isExternal()) { + return array( + 'path' => $this->getPath(), + 'options' => $this->getOptions(), + ); + } + else { + return array( + 'route_name' => $this->getRouteName(), + 'route_parameters' => $this->getRouteParameters(), + 'options' => $this->getOptions(), + ); + } } /** @@ -368,11 +376,19 @@ public function toArray() { * An associative array suitable for a render array. */ public function toRenderArray() { - return array( - '#route_name' => $this->getRouteName(), - '#route_parameters' => $this->getRouteParameters(), - '#options' => $this->getOptions(), - ); + if ($this->isExternal()) { + return array( + '#href' => $this->getPath(), + '#options' => $this->getOptions(), + ); + } + else { + return array( + '#route_name' => $this->getRouteName(), + '#route_parameters' => $this->getRouteParameters(), + '#options' => $this->getOptions(), + ); + } } /**