function LanguageListBuilder::buildRow
Same name in other branches
- 8.9.x core/modules/language/src/LanguageListBuilder.php \Drupal\language\LanguageListBuilder::buildRow()
- 10 core/modules/language/src/LanguageListBuilder.php \Drupal\language\LanguageListBuilder::buildRow()
- 11.x core/modules/language/src/LanguageListBuilder.php \Drupal\language\LanguageListBuilder::buildRow()
Overrides DraggableListBuilder::buildRow
File
-
core/
modules/ language/ src/ LanguageListBuilder.php, line 115
Class
- LanguageListBuilder
- Defines a class to build a listing of language entities.
Namespace
Drupal\languageCode
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
$row['default'] = [
'#type' => 'radio',
'#parents' => [
'site_default_language',
],
'#title' => t('Set @title as default', [
'@title' => $entity->label(),
]),
'#title_display' => 'invisible',
'#return_value' => $entity->id(),
'#id' => 'edit-site-default-language-' . $entity->id(),
];
// Mark the right language as default in the form.
if ($entity->id() == $this->languageManager
->getDefaultLanguage()
->getId()) {
$row['default']['#default_value'] = $entity->id();
}
return $row + parent::buildRow($entity);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.