Last active
October 21, 2017 13:47
-
-
Save Kloport/3db673a5109ba488bd947d6bf1d73963 to your computer and use it in GitHub Desktop.
This file contains 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
function getNodeAliases($langcode = 'en') { | |
$aliases = []; | |
$nids = \Drupal::entityQuery('node') | |
->condition('status', 1) // published | |
->condition('langcode', $langcode) | |
->execute(); | |
foreach ($nids as $nid) { | |
$system_path = '/node/' . $nid; | |
$path_alias = db_query("SELECT alias FROM {url_alias} WHERE source = '$system_path' AND langcode = '{$langcode}'")->fetchField(); | |
$aliases[] = $path_alias; | |
} | |
return $aliases; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment