You are here

public function PushNotificationsTokenListBuilder::buildRow in Push Notifications 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/Controller/PushNotificationsTokenListBuilder.php, line 56
Contains Drupal\push_notifications\Entity\Controller\PushNotificationsTokenListBuilder.

Class

PushNotificationsTokenListBuilder
Provides a list controller for push_notifications_token entity.

Namespace

Drupal\push_notifications\Entity\Controller

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\push_notifications\Entity\PushNotificationsToken */
  $row['id'] = $entity
    ->id();
  $row['owner']['data'] = array(
    '#theme' => 'username',
    '#account' => $entity
      ->getOwner(),
  );

  // Link to canonical URL and truncate token after 80 characters.
  $row['token'] = Link::fromTextAndUrl(Unicode::truncate($entity
    ->getToken(), 80, TRUE, TRUE), Url::fromRoute('entity.push_notifications_token.canonical', array(
    'push_notifications_token' => $entity
      ->id(),
  )));
  $row['network'] = $entity
    ->getNetwork();
  $row['created'] = $entity
    ->getCreatedTime();
  $row['langcode'] = $entity
    ->getLanguageCode();
  return $row + parent::buildRow($entity);
}