ExchangeRatesListBuilder.php in Commerce Exchanger 8
File
src/ExchangeRatesListBuilder.php
View source
<?php
namespace Drupal\commerce_exchanger;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class ExchangeRatesListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Exchange rates');
$header['id'] = $this
->t('Machine name');
$header['mode'] = $this
->t('Mode');
$header['status'] = $this
->t('Status');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$configuration = $entity
->getPluginConfiguration();
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['mode'] = $configuration['mode'] ?? 'live';
$row['status'] = $entity
->status() ? $this
->t('Enabled') : $this
->t('Disabled');
return $row + parent::buildRow($entity);
}
}