Created
March 8, 2022 21:54
-
-
Save twfahey1/002bb8858445d4365592e79ddda390a1 to your computer and use it in GitHub Desktop.
Drupal - Get URL from node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Core\Url; | |
$url_options = [ | |
'absolute' => TRUE, | |
'language' => \Drupal::languageManager()->getCurrentLanguage(), | |
]; | |
$link = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $url_options)->toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment