You are here

public function LanguageListBuilder::buildRow in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/language/src/LanguageListBuilder.php \Drupal\language\LanguageListBuilder::buildRow()

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides DraggableListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

core/modules/language/src/LanguageListBuilder.php, line 109
Contains \Drupal\language\LanguageListBuilder.

Class

LanguageListBuilder
Defines a class to build a listing of language entities.

Namespace

Drupal\language

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = $entity
    ->label();
  $row['default'] = array(
    '#type' => 'radio',
    '#parents' => array(
      'site_default_language',
    ),
    '#title' => t('Set @title as default', array(
      '@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);
}