function ContentDevelGenerate::getLangcode
Determine language based on $results.
1 call to ContentDevelGenerate::getLangcode()
- ContentDevelGenerate::develGenerateContentAddNode in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - Create one node. Used by both batch and non-batch code branches.
File
-
devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php, line 483
Class
- ContentDevelGenerate
- Provides a ContentDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
protected function getLangcode($results) {
if (isset($results['add_language'])) {
$langcodes = $results['add_language'];
$langcode = $langcodes[array_rand($langcodes)];
}
else {
$langcode = $this->languageManager
->getDefaultLanguage()
->getId();
}
return $langcode;
}