You are here

public function SitewideAlertListBuilder::buildRow in Sitewide Alert 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/SitewideAlertListBuilder.php, line 30

Class

SitewideAlertListBuilder
Defines a class to build a listing of Sitewide Alert entities.

Namespace

Drupal\sitewide_alert

Code

public function buildRow(EntityInterface $entity) {

  /* @var \Drupal\sitewide_alert\Entity\SitewideAlert $entity */
  $row['name'] = Link::createFromRoute($entity
    ->label(), 'entity.sitewide_alert.edit_form', [
    'sitewide_alert' => $entity
      ->id(),
  ]);
  $row['style'] = AlertStyleProvider::alertStyleName($entity
    ->getStyle());
  $row['active'] = $entity
    ->isPublished() ? '✔' : '✘';
  $row['scheduled'] = $entity
    ->isScheduled() ? '✔' : '✘';
  return $row + parent::buildRow($entity);
}