ModalListBuilder.php in Modal 5.0.x
File
src/ModalListBuilder.php
View source
<?php
namespace Drupal\modal_page;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class ModalListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Modal');
$header['id'] = $this
->t('Machine name');
$header['published'] = $this
->t('Status');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$status = $this
->t('Published');
if (empty($entity
->getPublished())) {
$status = $this
->t('Unpublished');
}
$row['published'] = $status;
return $row + parent::buildRow($entity);
}
}