public function Link::getUrlObject in Colossal Menu 8
Same name and namespace in other branches
- 2.x src/Entity/Link.php \Drupal\colossal_menu\Entity\Link::getUrlObject()
Returns a URL object containing either the external path or route.
Parameters
bool $title_attribute: (optional) If TRUE, add the link description as the title attribute if the description is not empty.
Return value
\Drupal\Core\Url A URL object containing either the external path or route.
Overrides MenuLinkInterface::getUrlObject
File
- src/
Entity/ Link.php, line 426
Class
- Link
- Defines the Link entity.
Namespace
Drupal\colossal_menu\EntityCode
public function getUrlObject($title_attribute = TRUE) {
if (!$this->url) {
if ($this
->get('link')
->isEmpty()) {
$this->url = Url::fromUri('internal:');
}
else {
$this->url = $this
->get('link')
->first()
->getUrl();
}
}
return $this->url;
}