I'm doing this:
$link = $node->field_link->first();
if ($link) {
$url = $link->getUrl()->toString();
...
}
If the value in the link field is /node/123
but there is a URL alias defined as:
Alias: /about-us System path: /node/123
I get /about-us
in $url
. I want to get /node/123
.
How do I get the raw url value instead of the aliased value?