You are here

public function LanguageFlagMappingListBuilder::buildRow in Flags 8

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 EntityListBuilder::buildRow

See also

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

File

src/Entity/LanguageFlagMappingListBuilder.php, line 75

Class

LanguageFlagMappingListBuilder
Provides a listing of flag mapping entities.

Namespace

Drupal\flags\Entity

Code

public function buildRow(EntityInterface $entity) {

  /** @var FlagMapping $entity */
  $allLanguages = $this->languageManager
    ->getAllDefinedLanguages();
  $id = $entity
    ->getSource();
  $row['language'] = isset($allLanguages[$id]) ? $allLanguages[$id] : $id;
  $row['flag']['data'] = [
    '#theme' => 'flags',
    '#code' => strtolower($entity
      ->getFlag()),
    '#source' => 'language',
  ];
  $row['info'] = $this->flags[$entity
    ->getFlag()];
  return $row + parent::buildRow($entity);
}