You are here

public function QueueStorageEntityListBuilder::buildRow in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php \Drupal\social_queue_storage\QueueStorageEntityListBuilder::buildRow()
  2. 8.8 modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php \Drupal\social_queue_storage\QueueStorageEntityListBuilder::buildRow()
  3. 10.0.x modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php \Drupal\social_queue_storage\QueueStorageEntityListBuilder::buildRow()
  4. 10.1.x modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php \Drupal\social_queue_storage\QueueStorageEntityListBuilder::buildRow()
  5. 10.2.x modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php \Drupal\social_queue_storage\QueueStorageEntityListBuilder::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

modules/custom/social_queue_storage/src/QueueStorageEntityListBuilder.php, line 30

Class

QueueStorageEntityListBuilder
Defines a class to build a listing of Queue storage entity entities.

Namespace

Drupal\social_queue_storage

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\social_queue_storage\Entity\QueueStorageEntity $entity */
  $row['id'] = $entity
    ->id();
  $row['name'] = $entity
    ->bundle();
  $row['owner'] = $entity
    ->getOwner()
    ->getDisplayName();

  // Add a description.
  $row_description = $entity
    ->label();
  if ($entity
    ->bundle() === 'email') {

    // When bundle is email, display the email subject.
    $row_description = $entity
      ->get('field_subject')->value;
  }
  $row['description'] = Link::createFromRoute($row_description, 'entity.queue_storage_entity.canonical', [
    'queue_storage_entity' => $entity
      ->id(),
  ]);
  return $row + parent::buildRow($entity);
}