W3cubDocs

/Drupal 8

public function Url::toRenderArray

public Url::toRenderArray()

Returns the route information for a render array.

Return value

array An associative array suitable for a render array.

File

core/lib/Drupal/Core/Url.php, line 744

Class

Url
Defines an object that holds information about a URL.

Namespace

Drupal\Core

Code

public function toRenderArray() {
  $render_array = [
    '#url' => $this,
    '#options' => $this->getOptions(),
  ];
  if (!$this->unrouted) {
    $render_array['#access_callback'] = [get_class(), 'renderAccess'];
  }
  return $render_array;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Url.php/function/Url::toRenderArray/8.1.x