Created
July 24, 2014 06:43
-
-
Save victor-shelepen/6dbc209765aee8f77113 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
$language_list = array ('ru', 'uk'); | |
foreach($article_list as $article) { | |
//$output .= print_r($article, 1); | |
$node = entity_create('node', array('type' => 'article', 'title' => $article['en']['title'], 'language' => 'en')); | |
$output .= $article['en']['title'] . '|<br>'; | |
$node->get('body')->setValue($article['en']['body']); | |
foreach ($language_list as $language) { | |
$translation = $node->getTranslation('ru'); | |
$output .= $article[$language]['title'] . '|<br>'; | |
if (empty($article[$language]['title'])) { | |
continue; | |
} | |
$translation->get('title')->setValue($article[$language]['title']); | |
$translation->get('body')->setValue($article[$language]['body']); | |
} | |
$node->save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment