IPRangesListBuilder.php in IP Ranges 8
File
lib/Drupal/ip_ranges/IPRangesListBuilder.php
View source
<?php
namespace Drupal\ip_ranges;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
class IPRangesListBuilder extends EntityListBuilder {
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage) {
parent::__construct($entity_type, $storage);
}
public function buildHeader() {
$header['label'] = t('Banned IP addresses');
$header['type'] = t('List type');
$header['description'] = t('IP Range description');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->getIpDisplay();
$row['type'] = $entity
->getType() ? t('Whitelist') : t('<strong>Blacklist</strong>');
$row['description'] = $entity
->getDescription();
return $row + parent::buildRow($entity);
}
public function getFormID() {
return 'ip_ranges_admin_form';
}
}