function LanguageItem::getPossibleOptions
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::getPossibleOptions()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::getPossibleOptions()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::getPossibleOptions()
Overrides OptionsProviderInterface::getPossibleOptions
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ LanguageItem.php, line 135
Class
- LanguageItem
- Defines the 'language' entity field item.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function getPossibleOptions(AccountInterface $account = NULL) {
$languages = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL);
return array_map(function (LanguageInterface $language) {
return $language->getName();
}, $languages);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.