UrlRedirectListBuilder.php in Url Redirect 8
File
src/Controller/UrlRedirectListBuilder.php
View source
<?php
namespace Drupal\url_redirect\Controller;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class UrlRedirectListBuilder extends ConfigEntityListBuilder {
protected $limit = 50;
protected function getEntityIds() {
$query = $this
->getStorage()
->getQuery()
->sort($this->entityType
->getKey('id'));
if ($this->limit) {
$query
->pager($this->limit);
}
return $query
->execute();
}
public function buildHeader() {
$header['label'] = $this
->t('Label');
$header['path'] = $this
->t('Path');
$header['redirect_path'] = $this
->t('Redirect Path');
$header['checked_for'] = $this
->t('Checked for');
$header['message'] = $this
->t('Display Message');
$header['status'] = $this
->t('Status');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $this
->getLabel($entity);
$row['path'] = $entity
->get_path();
$row['redirect_path'] = $entity
->get_redirect_path();
$row['checked_for'] = $entity
->get_checked_for();
$row['message'] = $entity
->get_message();
if ($entity
->get_status()) {
$status = t('Enabled');
}
else {
$status = t('Disabled');
}
$row['status'] = $status;
return $row + parent::buildRow($entity);
}
}