You are here

public function BrightcoveAPIClientListBuilder::buildRow in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/BrightcoveAPIClientListBuilder.php \Drupal\brightcove\BrightcoveAPIClientListBuilder::buildRow()
  2. 3.x src/BrightcoveAPIClientListBuilder.php \Drupal\brightcove\BrightcoveAPIClientListBuilder::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 EntityListBuilder::buildRow

See also

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

File

src/BrightcoveAPIClientListBuilder.php, line 46

Class

BrightcoveAPIClientListBuilder
Provides a listing of Brightcove API Client entities.

Namespace

Drupal\brightcove

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\brightcove\Entity\BrightcoveAPIClient $entity */
  $row['label'] = $entity
    ->label();
  $row['id'] = $entity
    ->id();
  if (self::$defaultAPIClient == $entity
    ->id()) {
    $row['id'] .= ' ' . $this
      ->t('(default)');
  }
  $row['account_id'] = $entity
    ->getAccountId();
  $row['default_player'] = BrightcovePlayer::getList($entity
    ->id())[$entity
    ->getDefaultPlayer()];

  // Try to authorize client to get client status.
  try {
    $entity
      ->authorizeClient();
    $row['client_status'] = $entity
      ->getClientStatus() ? $this
      ->t('OK') : $this
      ->t('Error');
  } catch (\Exception $e) {
    $row['client_status'] = $this
      ->t('Error');
  }
  return $row + parent::buildRow($entity);
}