Last active
October 21, 2017 13:42
-
-
Save Kloport/dcf0996aad972c26a6257f10df178372 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 getNodeContent( $id, $lang = '' ) { | |
$lang = $lang ?: \Drupal::languageManager()->getCurrentLanguage()->getId(); | |
$node = \Drupal::entityTypeManager() | |
->getStorage('node') | |
->load($id); | |
$translated_node = $node->getTranslation($lang); | |
return [$node, $translated_node]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment