LanguageListBuilder::buildRow

public LanguageListBuilder::buildRow(EntityInterface $entity)

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 103

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);
}
doc_Drupal
2016-10-29 09:22:33
Comments
Leave a Comment

Please login to continue.