You are here

public function PetListBuilder::buildRow in Previewable email templates 8.4

Same name and namespace in other branches
  1. 8 src/Controller/PetListBuilder.php \Drupal\pet\Controller\PetListBuilder::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/Controller/PetListBuilder.php, line 77

Class

PetListBuilder
Class for pet listing page.

Namespace

Drupal\pet\Controller

Code

public function buildRow(EntityInterface $entity) {
  $pid = $entity
    ->id();
  $row['id'] = $pid;
  $url = Url::fromRoute('pet.preview', array(
    'pet' => $pid,
  ));
  $row['label']['data'] = array(
    '#type' => 'link',
    '#title' => $entity
      ->getTitle(),
    '#url' => $url,
  );
  $row['subject'] = $entity
    ->getSubject();
  $row['status'] = $entity
    ->getStatus() == 0 ? $this
    ->t('Custom') : $entity
    ->getStatus();
  return $row + parent::buildRow($entity);
}