You are here

public function PushNotificationListBuilder::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/PushNotificationListBuilder.php, line 64
Contains Drupal\push_notifications\Entity\Controller\PushNotificationListBuilder

Class

PushNotificationListBuilder
Provides a list controller for the push_notification 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['user_id']['data'] = array(
    '#theme' => 'username',
    '#account' => $entity
      ->getOwner(),
  );
  $row['title'] = Link::fromTextAndUrl($entity
    ->getTitle(), Url::fromRoute('entity.push_notification.canonical', array(
    'push_notification' => $entity
      ->id(),
  )));
  $row['message'] = $entity
    ->getMessage();
  $row['created'] = $entity
    ->getCreatedTime();
  $row['pushed'] = $entity
    ->isPushed() ? $this
    ->t('Yes') : $this
    ->t('No');
  return $row + parent::buildRow($entity);
}