protected function ContentDevelGenerate::getLangcode in Devel 8
Same name and namespace in other branches
- 8.2 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\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;
}