You are here

public function MenuLinkContent::getUrlObject in Special menu items 8

Gets the url object pointing to the URL of the menu link content entity.

Return value

\Drupal\Core\Url A Url object instance.

Overrides MenuLinkContent::getUrlObject

File

src/MenuLinkContent.php, line 19
Contains \Drupal\menu_link_content\Entity\MenuLinkContent.

Class

MenuLinkContent
Overrides the MenuLinkContent class.

Namespace

Drupal\special_menu_items

Code

public function getUrlObject() {
  if (isset($this->link
    ->first()->uri)) {
    return $this->link
      ->first()
      ->getUrl();
  }
}